父组件调用子组件的方法/值
子组件
<script lang="ts" setup>
const test = (data: any) => {
console.log(data);
};
const text = ref('我是子组件的数据');
defineExpose({ test, text });
</script>
vue3组件
<script lang="ts" setup>
const test = (data: any) => {
console.log(data);
};
const text = ref('我是子组件的数据');
defineExpose({ test, text });
</script>