vue项目中某个页面监听全局点击事件方法
methods: { clickOther: function () {}; } mounted() { window.addEventListener("click", this.clickOther); } beforeDestroy() { // 实例销毁之前对点击事件进行解绑 window.removeEventListener('click', this.clickOther); }
methods: { clickOther: function () {}; } mounted() { window.addEventListener("click", this.clickOther); } beforeDestroy() { // 实例销毁之前对点击事件进行解绑 window.removeEventListener('click', this.clickOther); }