1:公众号手机返回问题,在vue下可如下处理:
mounted:if (window.history && window.history.pushState) {
history.pushState(null,null,document.URL);
window.addEventListener('popstate',this.goBack,false);
}
destoryed: window.removeEventListener('popstate',this.goBack,false)
2:在纯js下可做:
//返回操作
pushHistory(){
let state = {
title: "home",
url: "#"
};
window.history.pushState(state, "home", "#");
},
this.pushHistory();
window.addEventListener("popstate", function(e) {
wx.closeWindow();
}, false);