0
点赞
收藏
分享

微信扫一扫

微信小程序子组件向父组件传值和方法

苦茶如歌 2022-07-12 阅读 43


子组件

<button type="primary" bindtap="getoption">确定</button>
data: {
},
methods: {
getoption(e) {
this.triggerEvent('index', {i:1})//triggerEvent广播数据 index为广播事件
}
}

父组件

<share bind:index="getoption"></share>
getoption(e){
console.log(e.detail.i)
}


举报

相关推荐

0 条评论