//子组件
<script setup>
const emit = defineEmits(['xxx'])
const send = ()=>{
emit('xxx','程序猿')
}
</script >
//父组件
<template>
<Father @xxx="getName"></Father>
</template>
<script setup>
const getName(name)=>{
console.log(name,'父组件传过来的值')
}
</script>
Vue3 子传父
最新推荐文章于 2024-12-08 18:55:42 发布