vue使用keep-alive会将页面缓存的解决方法—activated(){}

当我们使用vue的时候有时候我们想使用keep-alive来将页面缓存下来,但有时候我们本身业务不能全部缓存,怎么解决这个问题呢

我们可以使用activeted(){}

例如:

1       methods: {
2         _text() {
3             console.log(1);
4         }
5     },
6     activated () {
7         this._text();
8     }

每次当我们再次进入页面的时候就会调用_text()这个方法

原文地址:https://www.cnblogs.com/tian-long/p/8484321.html