当前位置: 代码迷 >> 综合 >> <keep-alive> 和<router-view>实现路由缓存
  详细解决方案

<keep-alive> 和<router-view>实现路由缓存

热度:19   发布时间:2024-02-07 04:42:41.0
<transition name="fade" mode="out-in"><keep-alive><router-view :key="key"></router-view></keep-alive>
</transition>
key() {//实现路由缓存(由route.js中keepAlive动态控制)if (this.$route.meta.keepAlive != undefined) {if (this.$route.meta.keepAlive) {return this.$route.fullPath;}} else {return this.$route.path + new Date()}}

router.js

{path: 'attribute',component: _import('pdm/setting/attribute/index'),name: '属性管理',meta: {keepAlive: true,title: '属性管理'}},
  相关解决方案