提交 698d3362 编写于 作者: Cano1997's avatar Cano1997

fix: 修复分页导航激活页标识异常

上级 81bcd39f
...@@ -35,6 +35,8 @@ export const TabExpView = defineComponent({ ...@@ -35,6 +35,8 @@ export const TabExpView = defineComponent({
const deactivateAll = ref(false); const deactivateAll = ref(false);
const router = useRouter(proxy); const router = useRouter(proxy);
const cacheTab = ref('');
const tabExpPagesHistory: { const tabExpPagesHistory: {
[page: string]: string; [page: string]: string;
} = {}; } = {};
...@@ -44,7 +46,7 @@ export const TabExpView = defineComponent({ ...@@ -44,7 +46,7 @@ export const TabExpView = defineComponent({
const route = useRoute(proxy); const route = useRoute(proxy);
// 标签切换前缓存当前路径 // 标签切换前缓存当前路径
const fullPath = route.fullPath; const fullPath = route.fullPath;
tabExpPagesHistory[activeTab.value] = fullPath; tabExpPagesHistory[cacheTab.value] = fullPath;
// 找到对应分页模型并初始化分页视图模型 // 找到对应分页模型并初始化分页视图模型
const embedView = c.getEmbedViewByName(name); const embedView = c.getEmbedViewByName(name);
...@@ -72,10 +74,12 @@ export const TabExpView = defineComponent({ ...@@ -72,10 +74,12 @@ export const TabExpView = defineComponent({
setTimeout(() => { setTimeout(() => {
deactivateAll.value = false; deactivateAll.value = false;
activeTab.value = name; activeTab.value = name;
cacheTab.value = name;
}, 0); }, 0);
} else if (!lazyList.value.includes(name)) { } else if (!lazyList.value.includes(name)) {
lazyList.value.push(name); lazyList.value.push(name);
activeTab.value = name; activeTab.value = name;
cacheTab.value = name;
} }
}; };
...@@ -93,6 +97,7 @@ export const TabExpView = defineComponent({ ...@@ -93,6 +97,7 @@ export const TabExpView = defineComponent({
}); });
if (page) { if (page) {
activeTab.value = page.name; activeTab.value = page.name;
cacheTab.value = page.name;
} }
} }
} }
...@@ -185,6 +190,7 @@ export const TabExpView = defineComponent({ ...@@ -185,6 +190,7 @@ export const TabExpView = defineComponent({
lazyList, lazyList,
deactivateAll, deactivateAll,
activeTab, activeTab,
cacheTab,
keyHistory, keyHistory,
embedViewModal, embedViewModal,
renderDrTab, renderDrTab,
...@@ -202,7 +208,7 @@ export const TabExpView = defineComponent({ ...@@ -202,7 +208,7 @@ export const TabExpView = defineComponent({
<i-tabs <i-tabs
class={this.ns.e('tab')} class={this.ns.e('tab')}
name={this.c.model.codeName} name={this.c.model.codeName}
model-value={this.activeTab} v-model={this.activeTab}
on-on-click={this.onTabClick} on-on-click={this.onTabClick}
> >
{this.renderDrTab()} {this.renderDrTab()}
...@@ -212,8 +218,8 @@ export const TabExpView = defineComponent({ ...@@ -212,8 +218,8 @@ export const TabExpView = defineComponent({
<div class={this.ns.e('route-content')}> <div class={this.ns.e('route-content')}>
<router-view <router-view
// manualKey={this.c.tabExpPages[this.activeTab].key} // manualKey={this.c.tabExpPages[this.activeTab].key}
key={this.c.tabExpPages[this.activeTab].key} key={this.c.tabExpPages[this.cacheTab].key}
on-neuron-init={this.c.nerve.onNeuronInit(this.activeTab)} on-neuron-init={this.c.nerve.onNeuronInit(this.cacheTab)}
> >
{({ Component }: { Component: string }) => { {({ Component }: { Component: string }) => {
return ( return (
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册