feat: ✨ 1.18.0

This commit is contained in:
FairyEver
2020-08-25 16:50:56 +08:00
parent b9628d880e
commit 7211cce420
4 changed files with 15 additions and 3 deletions
+1 -1
View File
@@ -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",
@@ -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
+10 -1
View File
@@ -63,7 +63,7 @@
<div class="d2-theme-container-main-body" flex-box="1">
<transition :name="transitionActive ? 'fade-transverse' : ''">
<keep-alive :include="keepAlive">
<router-view/>
<router-view :key="routerViewKey" />
</keep-alive>
</transition>
</div>
@@ -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 最外层容器的背景图片样式
*/
+2 -1
View File
@@ -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()
}