vue页面离开后执行函数

版权声明:未经允许,请勿盗用 https://blog.csdn.net/qq_37916164/article/details/84099124
destroyed: function () {
           console.log("我已经离开了!");
    this.stopTimer();
 },

说明:destroyed是与methods、mounted同层级的

mounted(){
    this.startTimer();
},
//离开当前页面后执行
destroyed: function () {
    this.stopTimer();
},  

猜你喜欢

转载自blog.csdn.net/qq_37916164/article/details/84099124
今日推荐