test

Vue父组件访问子组件的方法

子组件方法

 methods: {
   setNewMsg (val) {
     this.msg = val
  }
}

父组件使子组件是加ref属性 

<subassembly ref="subassembly" />

this.$refs.subassembly.setNewMsg('父组件访问子组件方法')

 

posted @ 2021-08-29 23:51  知其一不知其二  阅读(82)  评论(0)    收藏  举报
hello world!!!
这是页脚HTML代码位置