摘要: 父组件:通过ref获取子组件实例 <template> <div style="text-align:center"> <button @click="callChildMethod">点击获取子组件数据</button> <div> 获取到子组件的数据如下: <div> {{childData}} 阅读全文
posted @ 2024-07-04 15:33 林财钦 阅读(2966) 评论(0) 推荐(0)
摘要: <!-- 父组件 --> <template> <h1>I am ParentComponent</h1> <ChildComponent @child-click="zCf"/> <h2>{{ x }}</h2> </template> <script setup> import ChildCom 阅读全文
posted @ 2024-07-04 15:13 林财钦 阅读(129) 评论(0) 推荐(0)
摘要: 父组件文件:parentcomponent.vue 子组件文件:childcomponent.vue 传普通值 传动态值 传对象 传数组 <!-- 父组件 --> <template> <h1>I am ParentComponent</h1> <ChildComponent msg="nice"/ 阅读全文
posted @ 2024-07-04 14:58 林财钦 阅读(1099) 评论(0) 推荐(0)