vue监听window的resize和scroll

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)
    })
}

你可能感兴趣的:(vue监听window的resize和scroll)