Implement the method in the child component in the parent component
Sub components:
I am a sub component
export default {
name: "child",
methods: {
parentHandleclick(e) {
console.log(e)
}
}
Parent component:
Click me to promote the subcomponent method
import Child from './child';
export default {
name: "parent",
components: {
child: Child
},
methods: {
clickParent() {
this.$ refs.mychild.parentHandleclick (the "parent component calls the child component method" < span style = "color:" ff0000; ">);
}
}
}
</span>