当前位置: 首页 > Web前端 > HTML

微信小程序获取子组件data中的数据值和方法

时间:2023-03-27 23:02:06 HTML

子组件:data:{show:true,},checkFun(){this.show=false}父组件:父组件使用子组件://获取子组件中的数据值constchild=this.selectComponent('#child');console.log(child.data.show);//调用子组件的useChildFun方法(){this.选择组件('#child')。检查乐趣();}