feat: ✨ 优化合并的代码 完成刷新单页面功能
This commit is contained in:
@@ -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 :key="$route.path + $route.meta[$route.path]" />
|
||||
<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 最外层容器的背景图片样式
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user