First, the registration page refreshes and closing events created in
created() {
window.addEventListener(
'beforeunload'
, e =>
this
.test(e))
}
Second, the event will be added to the list of your logical approach
methods: {
test
(e) {
console.log(
'刷新或关闭'
)
// ...
}
}
Third, the uninstallation events
destroyed() {
window.removeEventListener(
'beforeunload'
, e => this
.test(e)
)
}