当 goodsItem 需要调scroll.vue的方法,

方案一:可以用vuex 共享一个状态,在goodsItem去改变vuex的状态。然后在根组件中去监听vuex状态变化。

方案二:事件总线

在goodsItem发送事件this.$bus.$emit(‘imgOnload’) 

在根组件中 监听 this.$bus.$on('imgOnload',()=>{ 这里在做具体的事情  })

另外需要在main.js中 Vue.prototype.$bus = new Vue()

事件总线 this.$bus.$emit() this.$bus.$on

相关文章:

  • 2022-12-23
  • 2021-08-05
  • 2021-07-09
  • 2021-10-22
  • 2021-09-03
  • 2022-01-24
  • 2021-12-26
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-14
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-10
相关资源
相似解决方案