/*监听返回键*/
addUrl() {
<!--每调用一次addRrl即可监听一次返回键-->
<!--往windosw对象中的历史记录注入URL的方法-->
let state = { title: "title", url: "#" };
window.history.pushState(state, "title", "#");
this.monitorBack()
},
monitorBack(){
<!--监听popstate事件-->
let _this=this
window.addEventListener("popstate", function(e) {
if (_this.user.OilsList_show){
_this.$store.dispatch('user/setUserInfo_OilsList_show', false)
return false;
}
}, false);
}
复制代码
H5移动端监听返回键
最新推荐文章于 2024-04-25 09:35:16 发布