1.父组件调用子组件的方法
在父组件页面中显示子组件的标签中 添加属性ref=“namexxx”
在方法里面用 this.$refs.child.自组件方法名
下面看列子
父组件
<div @click="showChild">点击</div>
<div>
<component :is='test' ref="child"></component>
</div>
showChild(){
this.$refs.child.childMethods()//去调用子组件方法
}
子组件
childMethods(){
console.log("被父组件调用的方法")
}