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

fix: 修复分页导航视图跳转失效

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