子组件:

  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();
 }

我的一个道姑朋友
80 声望4 粉丝

星光不问赶路人,岁月不负有心人。