App.vue
1010 Bytes
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<template>
<!-- 页面缓存 -->
<router-view v-slot="{ Component, route }">
<keep-alive :include="keepPages">
<component :is="Component" :key="route.name" />
</keep-alive>
</router-view>
</template>
<script setup>
import { mainStore } from '@/store'
import { storeToRefs } from 'pinia'
import { computed, ref } from 'vue';
import vConsole from '@/utils/vconsole'
// 使用 include + pinia 状态管理动态缓存页面
const store = mainStore()
const keepPages = computed(() => {
return store.getKeepPages
})
</script>
<style lang="less">
@prefix: ~'@{namespace}-x';
html,
body {
width: 100%;
height: 100%;
}
body {
position: relative;
/* --van-white: #fff;
--van-blue: #1989fa;
--van-button-primary-color: var(--van-white);
--van-button-primary-background: var(--van-primary-color); */
/* 全局修改主色调 */
// --van-blue: #F9D95C;
// background-color: #FAFAFA;
p {
margin: 0;
padding: 0;
}
}
.@{prefix} {
color: red;
}
</style>