在tabpage的标签为top时显示区域标题栏

This commit is contained in:
zqm
2026-01-15 09:09:21 +08:00
parent 89f9884df9
commit 8a2b07d36f
4 changed files with 42 additions and 9 deletions

View File

@@ -223,6 +223,22 @@ const isSingleTabPageWithMultiplePanels = computed(() => {
return false;
});
// 计算属性TabPage的tabPosition
const tabPagePosition = computed(() => {
// 检查children配置
if (props.children) {
const childrenArray = Array.isArray(props.children) ? props.children : [props.children];
// 只有一个child且是TabPage
if (childrenArray.length === 1 && childrenArray[0].type === 'TabPage') {
return childrenArray[0].tabPosition || 'top';
}
}
// 默认top
return 'top';
});
// 计算属性:是否显示标题栏
const shouldShowTitleBar = computed(() => {
// 基础条件props.showTitleBar为true
@@ -231,8 +247,11 @@ const shouldShowTitleBar = computed(() => {
// 单面板场景不显示标题栏
if (isSinglePanel.value) return false;
// 只有一个TabPage且有多个Panel的情况不显示标题栏
if (isSingleTabPageWithMultiplePanels.value) return false;
// 只有一个TabPage且有多个Panel的情况
if (isSingleTabPageWithMultiplePanels.value) {
// 当tabPosition为top时显示标题栏其他位置不显示
return tabPagePosition.value === 'top';
}
// 检查children配置
if (props.children) {