Advertisement

vue项目的 bus 导致 request stacking 问题

阅读量:

使用bus总线后,
我注意到接口请求叠加。
然而,在之后的时间里,
我虽然定义和使用了bus总线,
并且尝试过关闭它(off),
但一直没成功。

一般地,在$on$off掉,在beforeDestory或者destoryed也要$off

复制代码
      mounted () {
    BusVue.$off('isShowBox')
    BusVue.$on('isShowBox', this.isShowBox)
      },
      beforeDestroy () {
    BusVue.$off('isShowBox')
      },

全部评论 (0)

还没有任何评论哟~