vue中this.$EventBus.$emit什么意思
时间: 2023-10-15 17:23:40 浏览: 140
Vue组件通信eventbus封装-类方式.zip
在Vue中,this.$EventBus.$emit表示通过EventBus对象触发一个事件。EventBus是一种用于在不同组件之间传递和监听事件的机制。该语句会触发一个名为"emit"的事件,并传递相应的参数。其他组件可以通过this.$EventBus.$on来监听该事件,并执行相应的逻辑。通过这种方式,不同组件之间可以进行通信和传递数据。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [vue使用this.$root.eventHub和this.$bus](https://blog.csdn.net/qq_45030898/article/details/131371261)[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 bus.$emit触发第一次$on监听不到问题](https://download.csdn.net/download/weixin_38648968/13128030)[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 ]
阅读全文