解析模板
This commit is contained in:
parent
7dfa5ed0a7
commit
8e1e74067d
|
|
@ -214,7 +214,7 @@ export default {
|
|||
proId: decryptWithSM4(this.$route.query.proId),
|
||||
bidId: decryptWithSM4(this.$route.query.bidId),
|
||||
activeMainTab: 'project',
|
||||
defaultSubTab: 'response',
|
||||
defaultSubTab: '', // 初始为空,由 AnalysisResultPanel 组件自动获取第一个子标签
|
||||
analysisData: {},
|
||||
tenderDocumentUrl: '',
|
||||
tenderDocumentTitle: '',
|
||||
|
|
@ -348,7 +348,16 @@ export default {
|
|||
},
|
||||
handleMainTabClick(tab) {
|
||||
this.activeMainTab = tab.name
|
||||
this.handleMainTabChange(tab.name, '')
|
||||
// 获取当前主标签的第一个子标签
|
||||
const currentMainTab = this.mainTabs.find(t => t.name === tab.name)
|
||||
const firstSubTab = currentMainTab && currentMainTab.subTabs && currentMainTab.subTabs.length > 0
|
||||
? currentMainTab.subTabs[0].name
|
||||
: ''
|
||||
// 强制更新 defaultSubTab,确保子标签切换
|
||||
this.$nextTick(() => {
|
||||
this.defaultSubTab = firstSubTab
|
||||
})
|
||||
this.handleMainTabChange(tab.name, firstSubTab)
|
||||
},
|
||||
handleMainTabChange(mainTab, subTab) {
|
||||
console.log('主标签切换:', mainTab, subTab)
|
||||
|
|
|
|||
|
|
@ -151,23 +151,52 @@ export default {
|
|||
}
|
||||
},
|
||||
data() {
|
||||
// 初始化时,如果 defaultSubTab 为空,获取第一个子标签
|
||||
const initialSubTab = this.defaultSubTab || this.getDefaultSubTab(this.defaultMainTab)
|
||||
return {
|
||||
activeMainTab: this.defaultMainTab,
|
||||
activeSubTab: this.defaultSubTab || this.getDefaultSubTab(this.defaultMainTab),
|
||||
activeSubTab: initialSubTab,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
defaultMainTab(newVal) {
|
||||
this.activeMainTab = newVal
|
||||
this.activeSubTab = this.getDefaultSubTab(newVal)
|
||||
defaultMainTab(newVal, oldVal) {
|
||||
if (newVal !== oldVal) {
|
||||
this.activeMainTab = newVal
|
||||
// 切换主标签时,总是获取第一个子标签
|
||||
const firstSubTab = this.getDefaultSubTab(newVal)
|
||||
if (firstSubTab) {
|
||||
this.activeSubTab = firstSubTab
|
||||
} else {
|
||||
this.activeSubTab = ''
|
||||
}
|
||||
}
|
||||
},
|
||||
defaultSubTab(newVal, oldVal) {
|
||||
// 当 defaultSubTab 变化时,更新 activeSubTab
|
||||
if (newVal && newVal !== oldVal) {
|
||||
this.activeSubTab = newVal
|
||||
} else if (!newVal) {
|
||||
// 如果为空,获取当前主标签的第一个子标签
|
||||
this.activeSubTab = this.getDefaultSubTab(this.activeMainTab)
|
||||
}
|
||||
},
|
||||
hideMainTabs(newVal) {
|
||||
if (newVal) {
|
||||
// 当隐藏主标签时,确保子标签正确初始化
|
||||
this.activeSubTab = this.getDefaultSubTab(this.defaultMainTab)
|
||||
if (!this.defaultSubTab) {
|
||||
this.activeSubTab = this.getDefaultSubTab(this.defaultMainTab)
|
||||
} else {
|
||||
this.activeSubTab = this.defaultSubTab
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// 初始化时,如果 activeSubTab 为空,确保获取第一个子标签
|
||||
if (!this.activeSubTab) {
|
||||
this.activeSubTab = this.getDefaultSubTab(this.activeMainTab)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleMainTabClick(tab) {
|
||||
// 切换主标签时,重置子标签为第一个
|
||||
|
|
|
|||
Loading…
Reference in New Issue