1.生命周期 deactivated 当路由发生变化的时候,会被调用。 在keep-alive组件的下,beforedistoryed 周期是不会执行的。可以用作替代。
2.每次进去一个组件,但是这个组件可能不会每次都更新数据。 处理方法。
beforeRouteLeave(to, from, next) {
if (from.path == "/control/ac") {
this.$destroy();
next();
}
}
3.vue中清除计时器:
clearInterval(this.page_timer);
this.page_timer=null;