vuejs用mounted创建监听事件,用destroyed销毁监听
mounted() {
//d创建监听
window.addEventListener("popstate", this.listenerPopstate, true);
},
destroyed() {
//销毁监听
window.removeEventListener("popstate", this.listenerPopstate, true);
},
methods: {
//监听方法
listenerPopstate() {
ZWJSBridge.close();
}
}
以上是编程学习网小编为您介绍的“vuejs用mounted创建监听事件,用destroyed销毁监听”的全面内容,想了解更多关于 vuejs 内容,请继续关注编程基础学习网。