Browse Source

调试浏览器返回的操作

master
453530270@qq.com 2 years ago
parent
commit
d74d81eb6e
  1. 18
      pages/login/components/main.vue
  2. 13
      pages/login/index.vue

18
pages/login/components/main.vue

@ -108,10 +108,19 @@
console.log('main created')
},
mounted() {
// ,
if(window.history && window.history.pushState){
window.addEventListener('popstate',this.goback,false)
}
},
methods: {
goback(){
console.log("6666666666666666666")
let path = this.$route.path
this.$toast(path)
},
//
radioChange(evt) {
this.userType = evt.detail.value
@ -247,6 +256,11 @@
},
},
//退
destroyed(){
//
window.removeEventListener('popstate',this.goback,false)
}
}
</script>

13
pages/login/index.vue

@ -32,14 +32,6 @@
}
},
//
activated() {
if(window.history && window.history.pushState){
history.pushState(null, null, document.URL);
window.addEventListener('popstate', this.goBack, false);
}
},
/**
* 生命周期函数--监听页面加载
*/
@ -109,11 +101,8 @@
//
// this.isParty = true
}
},
//
deactivated() {
window.removeEventListener('popstate', this.goBack, false);
}
}
</script>

Loading…
Cancel
Save