父组件中调用子组件的方法
时间: 2023-08-28 12:20:50 浏览: 94
在父组件中调用子组件的方法,首先需要给子组件添加一个ref属性,例如ref="child"。然后在父组件的方法中使用this.$refs.child.方法名()的方式来调用子组件的方法。具体来说,在父组件的closedDialog方法中,可以使用this.$refs.child.handleClose()来调用子组件的handleClose方法。这样就能实现在父组件中调用子组件的方法了。<span class="em">1</span><span class="em">2</span>
#### 引用[.reference_title]
- *1* [父组件如何调用子组件中的方法?](https://blog.csdn.net/ni15534789894/article/details/120501674)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [文字转语音API接口PHP源码](https://download.csdn.net/download/weixin_36643308/88214533)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文