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);
},