532def1c
王彪总
新版本
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<script setup lang="ts">
import { useTagsViewStore } from '@/store'
/**
* 内容区
*
* keep-alive 的 include 用 tagsView store 的 cachedViews(页面要缓存需满足:
* 路由有 name,且 meta.noCache 不为 true)。
*/
const tagsViewStore = useTagsViewStore()
const cachedViews = computed(() => tagsViewStore.cachedViews)
</script>
<template>
<section class="app-main">
<router-view v-slot="{ Component, route }">
<transition name="fade-transform" mode="out-in">
<keep-alive :include="cachedViews">
<component :is="Component" :key="route.path" />
</keep-alive>
</transition>
</router-view>
</section>
</template>
<style scoped lang="scss">
.app-main {
flex: 1;
min-height: 0;
overflow: auto;
background-color: $bg-page;
position: relative;
}
</style>
|