當前位置:編程學習大全網 - 網站源碼 - h5公眾號開發常見問題之無法返回

h5公眾號開發常見問題之無法返回

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);?

  • 上一篇:江西宏遠數碼顯示技術有限公司怎麽樣?
  • 下一篇:我在條件裏把源碼放進去,提示條件選股輸出不能超過1個,,無法選 股
  • copyright 2024編程學習大全網