mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
feat: 命名
This commit is contained in:
parent
e77733f73c
commit
ee8a84aabf
@ -37,7 +37,7 @@
|
|||||||
</router-view>
|
</router-view>
|
||||||
</template>
|
</template>
|
||||||
<router-view v-else v-slot="{ Component, route }">
|
<router-view v-else v-slot="{ Component, route }">
|
||||||
<keep-alive :include="includePages">
|
<keep-alive :include="keepAlivePages">
|
||||||
<component
|
<component
|
||||||
:is="getComponent(Component, route)"
|
:is="getComponent(Component, route)"
|
||||||
:key="getPageKey(route)"
|
:key="getPageKey(route)"
|
||||||
@ -151,7 +151,7 @@ export default {
|
|||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const includePages = ref([]);
|
const keepAlivePages = ref([]);
|
||||||
const getComponent = (Component, _route) => {
|
const getComponent = (Component, _route) => {
|
||||||
if (_route.meta['keep-alive']) {
|
if (_route.meta['keep-alive']) {
|
||||||
const name = _route.meta?.name || _route.name;
|
const name = _route.meta?.name || _route.name;
|
||||||
@ -159,8 +159,8 @@ export default {
|
|||||||
// 修改组件的 name
|
// 修改组件的 name
|
||||||
Component.type.name = name;
|
Component.type.name = name;
|
||||||
// 缓存的关键是组件name在keep-alive的include列表
|
// 缓存的关键是组件name在keep-alive的include列表
|
||||||
if (!includePages.value.includes(name)) {
|
if (!keepAlivePages.value.includes(name)) {
|
||||||
includePages.value = [...includePages.value, name];
|
keepAlivePages.value = [...keepAlivePages.value, name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,7 +177,7 @@ export default {
|
|||||||
handleCloseTab,
|
handleCloseTab,
|
||||||
actions,
|
actions,
|
||||||
getComponent,
|
getComponent,
|
||||||
includePages
|
keepAlivePages
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user