From 5e3eadf0eb844e2090a28174ff63feda3b82edbe Mon Sep 17 00:00:00 2001 From: FairyEver <1711467488@qq.com> Date: Tue, 25 Aug 2020 15:34:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20:sparkles:=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E7=9A=84=E4=BB=A3=E7=A0=81=20=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E5=88=B7=E6=96=B0=E5=8D=95=E9=A1=B5=E9=9D=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/header-aside/components/tabs/index.vue | 13 ++----------- src/layout/header-aside/layout.vue | 11 ++++++++++- src/views/system/function/refresh/index.js | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) 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()