子组件调用父组件的方法并传值
时间: 2023-10-13 22:04:15 浏览: 74
要实现子组件调用父组件的方法并传值,可以按照以下步骤进行操作:
1. 在子组件中定义一个事件,使用`this.$emit('事件名', 参数)`的语法发射事件。例如,子组件中定义一个名为`btn-click`的事件,并传递一个名为`item`的参数。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [vue 子组件调用父组件方法、值(父传子);父组件调用子组件方法、值(子传父)。](https://blog.csdn.net/m0_65274248/article/details/127536414)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [⒒ Vue子组件向父组件传值](https://blog.csdn.net/CRMEB/article/details/112471770)[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^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文