微信小程序-从组件触发页面任务

组件:第一个参数传入出发方法的名字,第二个参数传入需要传入的参数

this.triggerEvent('timeUpdate',{
              currentTime
            })

页面:bind:xxx,   xxx为传入的方法  也可以直接bindxxx

 <l-progress-bar bindtimeUpdate="timeUpdate" bindmusicEnd="next" />

页面.js

timeUpdate(event){
    console.log(event.detail)
  },

猜你喜欢

转载自www.cnblogs.com/lxz-blogs/p/12672362.html
今日推荐