微信小程序學習之triggerEvent

    1.tag/index.wxml

    <view bind:tap="onTap"></view>

    2.tag/index.js

    properties:{
        text:String
    },
    methods:{
        onTap:function(event){
            this.triggerEvent("tapping",{
                text:this.propertie.text
            },{})
        }
    }

    3.在父組件頁面上要引入子組件

        1.detail.wxml

      <tap-cmp bind:tapping="onPost"></tap-cmp>

        2.detail.js

      onPost:function(event){
          event.detail.text
      }


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章