<template>
<div class="home">
<p>父组件</p>
<child @myevent="parentMethod"></child>
</div>
</template>
<script>
const child = {
//触发myevent事件
template: `<div @click="$emit('myevent')">子组件</div>`,
emits:['myevent']
}
export default {
name: "Home",
components:{
child
},
setup() {
emits: {
click: null,
}
methods:{
parentMethod(){
console.log("父组件方法")
}
}
}
</script>