vue | $bus

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

组件1:

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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章