H5监听路由
通过监听路由来实现路由的固定回退
created(){
this.listenerBack()
}
methods(){
listenerBack(){
window.addEventListener('popstate',this.back,false)
},
beforeRouteLeave(to,from,next){
window.removeEventListener('popstate',this.back,false)
next()
}
back(){
this.$router.push({
原创
2021-05-26 16:19:03 ·
430 阅读 ·
0 评论