Browse Source

调试浏览器返回的操作

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

20
pages/login/components/main.vue

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

15
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 // this.isParty = true
} }
}, }
//
deactivated() {
window.removeEventListener('popstate', this.goBack, false);
}
} }
</script> </script>

Loading…
Cancel
Save