diff --git a/package.json b/package.json index 73caa73..83627c3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "d2-admin", - "version": "1.14.0", + "version": "1.18.0", "scripts": { "serve": "vue-cli-service serve --open", "start": "npm run serve", diff --git a/src/layout/header-aside/components/tabs/index.vue b/src/layout/header-aside/components/tabs/index.vue index d83e4f4..d0ec0c7 100644 --- a/src/layout/header-aside/components/tabs/index.vue +++ b/src/layout/header-aside/components/tabs/index.vue @@ -74,6 +74,7 @@ export default { { icon: 'times-circle', title: '关闭全部', value: 'all' } ], contextmenuList: [ + { icon: 'refresh', title: '刷新', value: 'refresh' }, { icon: 'arrow-left', title: '关闭左侧', value: 'left' }, { icon: 'arrow-right', title: '关闭右侧', value: 'right' }, { icon: 'times', title: '关闭其它', value: 'other' }, @@ -142,6 +143,7 @@ export default { if (tagName) this.contextmenuFlag = false const params = { pageSelect: tagName } switch (command) { + case 'refresh': this.$router.push({ name: 'refresh' }); break case 'left': this.closeLeft(params); break case 'right': this.closeRight(params); break case 'other': this.closeOther(params); break diff --git a/src/layout/header-aside/layout.vue b/src/layout/header-aside/layout.vue index 839e443..261d004 100644 --- a/src/layout/header-aside/layout.vue +++ b/src/layout/header-aside/layout.vue @@ -63,7 +63,7 @@
- +
@@ -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 e8b3503..18406b4 100644 --- a/src/views/system/function/refresh/index.js +++ b/src/views/system/function/refresh/index.js @@ -1,6 +1,7 @@ export default { beforeRouteEnter (to, from, next) { - next(instance => instance.$router.replace(from.fullPath)) + from.meta[`__stamp-${from.path}`] = Date.now() + next(instance => instance.$router.replace({ path: from.fullPath, meta: from.meta })) }, render: h => h() }