H 5携帯電話返却イベントの傍受
567 ワード
1.popstateを使用してリターンイベントをリスニングする
// mounted popstate
mounted(){
if (window.history && window.history.pushState) {
history.pushState(null, null, '#1');
window.addEventListener('popstate', this.backChange, false);
}
},
backChange(e){
history.pushState(null, null, '#1');
this.isShow=true; //
},
destroyed(){
window.removeEventListener('popstate', this.backChange, false);
},