<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 子傳父 ***** >>子傳父通過$emit('自定義事件名稱',需要傳遞的變量)完成 ***** > 1. 使用$emit()觸發自定義事件,觸發方法就可以帶上變量 this.$emit(自定義事件名稱, 需要傳遞給父的值) > 2. 找到子組件標簽<my-con> ,在這個標簽上增加一個自定義事件, 通過@自定義事件="響應事件的方法" > 3. 在父組件上實現相應方法,方法接受的參數,就是觸發自定義事件傳遞的值 <br> ``` <div id="app"> <my-con1></my-con1> </div> <template id="temp"> <div> <p>我是1111{{str}} {{str1}}</p> //在子組件上綁定自定義事件 @自定義事件名 = ‘響應事件的方法’ <my-con2 @getstr='newStr'></my-con2> </div> </template> <template id="temp1"> <div> <p>我是2222{{str}}</p> //觸發子組件上的方法(里面是自定義事件) <button @click='getStr'>按鈕</button> </div> </template> <script> new Vue({ el: '#app', components: { 'MyCon1': { template: '#temp', data: function () { return { str: '+++1111str', str1: '' } }, methods: { newStr(c) { this.str1 = c; } }, components: { 'MyCon2': { template: '#temp1', data: function () { return { str: '+++22222str' } }, methods: { getStr() { //自定義事件,傳遞需要傳遞的變量 //事件名不能有大寫 this.$emit('getstr', this.str); } } } } }, }, }) </script> ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看