- +
- + @sub-tab-change="handleSubTabChange" :hide-main-tabs="true" :key="activeMainTab"> @@ -126,6 +160,11 @@ export default { defaultSubTab: { type: String, default: '' + }, + // 是否隐藏主标签页 + hideMainTabs: { + type: Boolean, + default: false } }, data() { @@ -138,6 +177,12 @@ export default { defaultMainTab(newVal) { this.activeMainTab = newVal this.activeSubTab = this.getDefaultSubTab(newVal) + }, + hideMainTabs(newVal) { + if (newVal) { + // 当隐藏主标签时,确保子标签正确初始化 + this.activeSubTab = this.getDefaultSubTab(this.defaultMainTab) + } } }, methods: {