全局下拉框添加filterable属性
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
<template>
|
||||
<el-main class="layout-main" :style="mainHeight()">
|
||||
<router-view v-slot="{ Component }">
|
||||
<transition :name="config.layout.mainAnimation">
|
||||
<router-view v-slot="{ Component, route: viewRoute }">
|
||||
<transition :name="config.layout.mainAnimation" mode="out-in">
|
||||
<keep-alive :include="state.keepAliveComponentNameList">
|
||||
<component :is="Component" :key="state.componentKey || undefined" />
|
||||
<component
|
||||
:is="Component"
|
||||
v-if="Component"
|
||||
:key="state.componentKey || viewRoute.fullPath"
|
||||
/>
|
||||
</keep-alive>
|
||||
</transition>
|
||||
</router-view>
|
||||
@@ -51,9 +55,10 @@ onBeforeMount(() => {
|
||||
state.keepAliveComponentNameList = state.keepAliveComponentNameList.filter(
|
||||
(name: string) => menu.meta.keepalive !== name
|
||||
)
|
||||
state.componentKey = ''
|
||||
// 临时换 key 强制卸载,再在 nextTick 恢复为路由 fullPath,避免 keep-alive 缓存错乱
|
||||
state.componentKey = `${menu.fullPath || menu.path}__refresh__${Date.now()}`
|
||||
nextTick(() => {
|
||||
state.componentKey = menu.path
|
||||
state.componentKey = ''
|
||||
addKeepAliveComponentName(menu.meta.keepalive as string)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user