Function code triggered by vue leaving the current page
- 2021-08-09 07:00:13
- OfStack
I won't talk too much, let's just look at the code ~
destroyed(){
console.log(' Destruction ')
}
Additional knowledge: Execute functions after entering and leaving the routing page in vue
Go to the Routing page
mounted(){
this.$nextTick(()=>{
show();
})
}
Execute the function after leaving the routing page
destroyed: function () {
console.log(" I've already left! ");
this.stopTimer();
},
Note: destroyed is at the same level as methods and mounted
mounted(){
this.startTimer();
},
// Execute after leaving the current page
destroyed: function () {
this.stopTimer();
},