Browse Source

update: 修改keep-alive缓存

刘洋 3 years ago
parent
commit
54cdc8a0f8

+ 1 - 1
2022/aiot-evaluate/src/components/dialog/drawer/IpuDrawer.vue

@ -90,7 +90,7 @@ const emits = defineEmits(['changeEvent', 'blurEvent']);
90 90
const changeEvent = (form) => {
91 91
  emits('changeEvent', form);
92 92
};
93
const handleClose = () => {};
93
// const handleClose = () => {};
94 94
95 95
// 触发blur事件
96 96
const blurEvent = (form) => {

+ 11 - 2
2022/aiot-evaluate/src/views/Home.vue

@ -39,10 +39,19 @@
39 39
          <div class="content">
40 40
            <router-view v-slot="{ Component }">
41 41
              <transition name="fade" mode="slide-right">
42
                <keep-alive :include="tagsList">
43
                  <component :is="Component" :key="$route.name" />
42
                <keep-alive max="30" :include="tagsList">
43
                  <component
44
                    :is="Component"
45
                    :key="`${$route.name} ${new Date().getTime()}`"
46
                    v-if="$route.meta.keepAlive"
47
                  />
44 48
                </keep-alive>
45 49
              </transition>
50
              <component
51
                :is="Component"
52
                :key="$route.name"
53
                v-if="!$route.meta.keepAlive"
54
              />
46 55
            </router-view>
47 56
          </div>
48 57
        </div>

+ 10 - 5
2022/aiot-evaluate/src/views/settings/index.js

@ -1,5 +1,7 @@
1
const ApiResourceManagement = () => import('../settings/ApiResourceManagement.vue');
2
const ApplicationManagement = () => import('../settings/ApplicationManagement.vue');
1
const ApiResourceManagement = () =>
2
  import('../settings/ApiResourceManagement.vue');
3
const ApplicationManagement = () =>
4
  import('../settings/ApplicationManagement.vue');
3 5
const RoleManagement = () => import('../settings/RoleManagement.vue');
4 6
5 7
export default {
@ -12,7 +14,8 @@ export default {
12 14
    path: '/role',
13 15
    name: 'RoleManagement',
14 16
    meta: {
15
      title: '角色管理'
17
      title: '角色管理',
18
      keepAlive: true
16 19
    },
17 20
    component: RoleManagement
18 21
  },
@ -20,7 +23,8 @@ export default {
20 23
    path: '/api-lication',
21 24
    name: 'ApplicationManagement',
22 25
    meta: {
23
      title: '应用管理'
26
      title: '应用管理',
27
      keepAlive: true
24 28
    },
25 29
    component: ApplicationManagement
26 30
  },
@ -28,7 +32,8 @@ export default {
28 32
    path: '/api-resource',
29 33
    name: 'ApiResourceManagement',
30 34
    meta: {
31
      title: 'API资源管理'
35
      title: 'API资源管理',
36
      keepAlive: true
32 37
    },
33 38
    component: ApiResourceManagement
34 39
  }]