@@ -12,9 +12,16 @@ import { appStore } from '/@/store/modules/app';
12
12
export default defineComponent ( {
13
13
name : 'PageLayout' ,
14
14
setup ( ) {
15
- const getProjectConfigRef = computed ( ( ) => {
16
- return appStore . getProjectConfig ;
15
+ const getProjectConfigRef = computed ( ( ) => appStore . getProjectConfig ) ;
16
+ const openCacheRef = computed ( ( ) => {
17
+ const {
18
+ openKeepAlive,
19
+ multiTabsSetting : { show } ,
20
+ } = unref ( getProjectConfigRef ) ;
21
+ return openKeepAlive && show ;
17
22
} ) ;
23
+ const getCacheTabsRef = computed ( ( ) => toRaw ( tabStore . getKeepAliveTabsState ) as string [ ] ) ;
24
+
18
25
const { openPageLoading } = unref ( getProjectConfigRef ) ;
19
26
20
27
let on = { } ;
@@ -27,21 +34,20 @@ export default defineComponent({
27
34
const {
28
35
routerTransition,
29
36
openRouterTransition,
30
- openKeepAlive,
31
- multiTabsSetting : { show, max } ,
37
+ multiTabsSetting : { max } ,
32
38
} = unref ( getProjectConfigRef ) ;
33
39
34
- const openCache = openKeepAlive && show ;
35
- const cacheTabs = toRaw ( tabStore . getKeepAliveTabsState ) as string [ ] ;
36
40
return (
37
41
< div >
38
42
< RouterView >
39
43
{ {
40
44
default : ( { Component, route } : { Component : any ; route : RouteLocation } ) => {
41
45
// No longer show animations that are already in the tab
42
- const name = route . meta . inTab ? 'fade' : null ;
46
+ const cacheTabs = unref ( getCacheTabsRef ) ;
47
+ const isInCache = cacheTabs . includes ( route . name as string ) ;
48
+ const name = isInCache && route . meta . inTab ? 'fade' : null ;
43
49
44
- const Content = openCache ? (
50
+ const Content = unref ( openCacheRef ) ? (
45
51
< KeepAlive max = { max } include = { cacheTabs } >
46
52
< Component key = { route . fullPath } />
47
53
</ KeepAlive >
0 commit comments