$emit方法
父组件
<template> <div> <child @callFather="activeSon"></child> </div> </template> <script> import child from '@/components/child'; export default { components: { child }, methods: { fatherMethod() { console.log('father组件'); }, activeSon(){ this.fatherMethod() } } } </script>
子组件
<template> <div @click="activeBtn"> </div> </template> <script> export default { methods: { activeBtn() { this.$emit("callFather") } } } </script>