vue keeplive的缓存页面如何销毁重新渲染
//通过组件key属性实现重新渲染 <template> <NoticeCollectionKey :key="componentKey"/></template> <script> //原来的页面定义为一个组件import进来 import NoticeCollectionKey from "./NoticeCollectionKey.vue"; export default { components: { NoticeCollectionKey }, beforeRouteEnter(to, from, next) { next(vm => { //从des页面来 就要销毁重新渲染 其他时候正常缓存页面 if (from.path === "/des") vm.forceRerender(); }); }, data() { return { componentKey: 0 }; }, methods: { forceRerender() { this.componentKey += 1; } } }; </script> <style></style>