vue | $bus

在组件1中调用组件2中的方法

组件1:

this.$bus.$emit("change_event", "参数")
 
组件2:
mounted () {
    this.$bus.$on('change_event', (参数) => {
    // 需要调用的方法
      this.init() 
    })
 }

 

posted @ 2023-02-10 11:02  三水儿  阅读(15)  评论(0编辑  收藏  举报