diff --git a/src/layout/header-aside/components/tabs/index.vue b/src/layout/header-aside/components/tabs/index.vue index 4ca15fe3..d0ec0c7e 100644 --- a/src/layout/header-aside/components/tabs/index.vue +++ b/src/layout/header-aside/components/tabs/index.vue @@ -27,9 +27,6 @@
- - - - +
@@ -126,6 +126,15 @@ export default { ...mapGetters('d2admin', { themeActiveSetting: 'theme/activeSetting' }), + /** + * @description 用来实现带参路由的缓存 + */ + routerViewKey () { + // 默认情况下 key 类似 __transition-n-/foo + // 这里的字符串操作是为了最终 key 的格式和原来相同 类似 __transition-n-__stamp-time-/foo + const stamp = this.$route.meta[`__stamp-${this.$route.path}`] || '' + return `${stamp ? `__stamp-${stamp}-` : ''}${this.$route.path}` + }, /** * @description 最外层容器的背景图片样式 */ diff --git a/src/views/system/function/refresh/index.js b/src/views/system/function/refresh/index.js index 03ef5ad8..18406b4a 100644 --- a/src/views/system/function/refresh/index.js +++ b/src/views/system/function/refresh/index.js @@ -1,6 +1,6 @@ export default { beforeRouteEnter (to, from, next) { - from.meta[from.path] = Date.now() + from.meta[`__stamp-${from.path}`] = Date.now() next(instance => instance.$router.replace({ path: from.fullPath, meta: from.meta })) }, render: h => h()