子组件
<view bindtap="onItemChildClick" data-item="item">{{item}}</view>
Component({
methods: {
onItemChildClick(event) {
this.triggerEvent("onItemChildClick", event.currentTarget.dataset.item)
}
}
})
父组件
<xq-item bind:onItemChildClick="onItemPersonClick">
Page({
methods: {
onItemPersonClick(item) {
// 监听子组件事件
}
}
})
标签:methods,自定义,onItemChildClick,item,事件,组件,event
From: https://www.cnblogs.com/IT-IOS-MAN/p/16891254.html