mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2025-01-31 17:12:49 +08:00
优化 keep-alive 缓存方式
This commit is contained in:
parent
49dd4a55eb
commit
1012c419ac
@ -44,10 +44,9 @@
|
||||
<div class="main-box">
|
||||
<el-main>
|
||||
<router-view v-slot="{ Component }">
|
||||
<keep-alive>
|
||||
<component v-if="$route.meta.keepAlive" :is="Component" :key="$route.path" />
|
||||
<keep-alive :include="$global.visitedViews.filter(it => it.meta.keepAlive).map(it => it.path.substr(it.path.lastIndexOf('/') + 1))">
|
||||
<component :is="Component" :key="$route.path" />
|
||||
</keep-alive>
|
||||
<component v-if="!$route.meta.keepAlive" :is="Component" :key="$route.path" />
|
||||
</router-view>
|
||||
</el-main>
|
||||
</div>
|
||||
|
@ -1,8 +1,7 @@
|
||||
<template>
|
||||
<router-view v-slot="{ Component }">
|
||||
<keep-alive>
|
||||
<component v-if="$route.meta.keepAlive" :is="Component" :key="$route.path" />
|
||||
<keep-alive :include="$global.visitedViews.filter(it => it.meta.keepAlive).map(it => it.path.substr(it.path.lastIndexOf('/') + 1))">
|
||||
<component :is="Component" :key="$route.path" />
|
||||
</keep-alive>
|
||||
<component v-if="!$route.meta.keepAlive" :is="Component" :key="$route.path" />
|
||||
</router-view>
|
||||
</template>
|
||||
</template>
|
||||
|
Loading…
Reference in New Issue
Block a user