子组件:
data: {
show: true,
},
checkFun() {
this.show = false
}
父组件:
父组件应用子组件:
<child id="child"></child>
// 获取子组件中的data值
const child= this.selectComponent('#child');
console.log(child.data.show);
// 调用子组件的办法
useChildFun() {
this.selectComponent('#child').checkFun();
}
发表回复