mounted(){
//监听注册
history.pushState(null, null, document.URL);
window.addEventListener('popstate', this.popstate,false)
},
//监听销毁
beforeDestroy() {
window.removeEventListener('popstate', this.popstate())
},
methods:{
//监听处理
popstate(){
history.pushState(null, null, document.URL);
},
}
前端路由监听与Popstate事件处理

3133

被折叠的 条评论
为什么被折叠?



