vue监听window的resize和scroll

2021-07-01  本文已影响0人  天海相接
mounted(){
    this.initPlugin();
    win.addEventListener('resize',this.resizePlayer);
    win.addEventListener('scroll',this.resizePlayer);
    this.$once('hook:beforeDestroy',() => {
      this.freePluge()
      win.removeEventListener('resize',this.resizePlayer)
      win.removeEventListener('scroll',this.resizePlayer)
    })
}
上一篇 下一篇

猜你喜欢

热点阅读