子:
const emit = defineEmits([]); //声明emit
const score = ref('sun') //要传的值
const fun = ()=>{
emit("fatherFunction", score.value);
}
父:
<!-- 父的子组件标签 @对应子组件emit括号中的方法名 =号内是子组件要调用的父页面的方法 -->
<formA :data="formState.synthesizeData" @fatherFunction="fatherFun"></formA>
<script setup>
//val与子组件emit括号中的score.value相对应
const fatherFun= (val) => {
console.log(val)
};
</script>