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

昔不亏
2024-11-27
1<script lang="ts" setup> 2 const test = (data: any) => { 3 console.log(data); 4 }; 5 const text = ref('我是子组件的数据'); 6 defineExpose({ test, text }); 7</script>