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

fix: 修复分页导航视图分页标签回显异常

上级 779e7312
......@@ -16,6 +16,7 @@ import {
} from 'vue';
import './tab-exp-view.scss';
import { DRTabModel, TabExpPanelModel } from '@ibiz-template/model';
import { Neuron } from '@ibiz-template/controller';
export const TabExpView = defineComponent({
props: {
......@@ -34,6 +35,7 @@ export const TabExpView = defineComponent({
// 使分页都不激活
const deactivateAll = ref(false);
const router = useRouter(proxy);
const tabRef = ref<IData | null>(null);
const tabExpPagesHistory: {
[page: string]: string;
......@@ -41,11 +43,6 @@ export const TabExpView = defineComponent({
// 点击回调
const onTabClick = async (name: string) => {
const route = useRoute(proxy);
// 标签切换前缓存当前路径
const fullPath = route.fullPath;
tabExpPagesHistory[activeTab.value] = fullPath;
// 找到对应分页模型并初始化分页视图模型
const embedView = c.getEmbedViewByName(name);
if (!embedView) {
......@@ -110,6 +107,15 @@ export const TabExpView = defineComponent({
const embedViewModal = { mode: ViewMode.EMBED };
const onNeuronInit = (neuron: Neuron) => {
const route = useRoute(proxy);
// 标签切换前缓存当前路径
const fullPath = route.fullPath;
tabExpPagesHistory[activeTab.value] = fullPath;
const fn = c.nerve.onNeuronInit(activeTab.value);
fn(neuron);
};
const renderTabExpPage = () => {
if (c.model.tabExpPanel.controlType === 'TABEXPPANEL') {
const { tabExpPages = [] } = c.model.tabExpPanel as TabExpPanelModel;
......@@ -181,12 +187,14 @@ export const TabExpView = defineComponent({
return {
c,
ns,
tabRef,
onTabClick,
lazyList,
deactivateAll,
activeTab,
keyHistory,
embedViewModal,
onNeuronInit,
renderDrTab,
renderTabExpPage,
};
......@@ -200,9 +208,10 @@ export const TabExpView = defineComponent({
>
{this.c.complete && [
<i-tabs
ref={this.tabRef}
class={this.ns.e('tab')}
name={this.c.model.codeName}
model-value={this.activeTab}
v-model={this.activeTab}
on-on-click={this.onTabClick}
>
{this.renderDrTab()}
......@@ -213,7 +222,7 @@ export const TabExpView = defineComponent({
<router-view
// manualKey={this.c.tabExpPages[this.activeTab].key}
key={this.c.tabExpPages[this.activeTab].key}
on-neuron-init={this.c.nerve.onNeuronInit(this.activeTab)}
on-neuronInit={this.onNeuronInit}
>
{({ Component }: { Component: string }) => {
return (
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册