fix: render header in all layouts (sidebar layout has tools-only header)

左右布局顶栏仅不含导航菜单,折叠/面包屑/全屏/暗黑/设置/用户等工具照常;
固定顶栏对所有布局生效(移除左右禁用)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
liuyun 2026-10-11 00:23:25 +08:00
parent 6ef0b1121c
commit 86af3c10e1
5 changed files with 6 additions and 11 deletions

View File

@ -36,7 +36,7 @@
</el-menu> </el-menu>
</div> </div>
<ty-breadcrumb v-if="showBreadcrumb && layout !== 'top'" :items="breadcrumbs" class="ty-header__breadcrumb" /> <ty-breadcrumb v-if="showBreadcrumb" :items="breadcrumbs" class="ty-header__breadcrumb" />
<div class="ty-header__right"> <div class="ty-header__right">
<button v-if="showFullscreen" class="ty-header__action" type="button" title="全屏" @click="emit('toggle-fullscreen')"> <button v-if="showFullscreen" class="ty-header__action" type="button" title="全屏" @click="emit('toggle-fullscreen')">

View File

@ -20,7 +20,7 @@
</div> </div>
<div class="ty-setting-panel__row"> <div class="ty-setting-panel__row">
<span>固定顶栏</span> <span>固定顶栏</span>
<el-switch v-model="local.headerFixed" :disabled="local.layout === 'sidebar'" @change="emitUpdate" /> <el-switch v-model="local.headerFixed" @change="emitUpdate" />
</div> </div>
<div class="ty-setting-panel__row"> <div class="ty-setting-panel__row">
<span>固定底部</span> <span>固定底部</span>

View File

@ -1,7 +1,6 @@
<template> <template>
<div class="app-shell" :style="cssVars"> <div class="app-shell" :style="cssVars">
<ty-header <ty-header
v-if="app.hasHeader"
:title="title" :title="title"
:has-sidebar="app.hasSidebar" :has-sidebar="app.hasSidebar"
:collapsed="app.sidebarCollapsed" :collapsed="app.sidebarCollapsed"
@ -112,11 +111,11 @@ const breadcrumbs = computed<BreadcrumbItem[]>(() => {
return [{ title: top.name }] return [{ title: top.name }]
}) })
/** 侧边栏 sticky 定位(有固定顶栏时往下让出顶栏高度)。 */ /** 侧边栏 sticky 定位(顶栏固定时往下让出顶栏高度)。 */
const cssVars = computed(() => ({ const cssVars = computed(() => ({
'--ty-header-height': `${HEADER_HEIGHT}px`, '--ty-header-height': `${HEADER_HEIGHT}px`,
'--ty-sidebar-top': app.hasHeader && app.headerFixed ? `${HEADER_HEIGHT}px` : '0px', '--ty-sidebar-top': app.headerFixed ? `${HEADER_HEIGHT}px` : '0px',
'--ty-sidebar-height': app.hasHeader && app.headerFixed ? `calc(100vh - ${HEADER_HEIGHT}px)` : '100vh', '--ty-sidebar-height': app.headerFixed ? `calc(100vh - ${HEADER_HEIGHT}px)` : '100vh',
})) }))
/** 布局设置快照(传给设置面板)。 */ /** 布局设置快照(传给设置面板)。 */

View File

@ -22,9 +22,6 @@ export const useAppStore = defineStore(
const showFullscreen = ref(defaultLayout.showFullscreen) const showFullscreen = ref(defaultLayout.showFullscreen)
const menuAccordion = ref(defaultLayout.menuAccordion) const menuAccordion = ref(defaultLayout.menuAccordion)
/** 是否有顶栏:horizontal / top 有,sidebar(左右)无。 */
const hasHeader = computed(() => layout.value !== 'sidebar')
/** 是否渲染侧边栏:horizontal / sidebar 有,top 无。 */ /** 是否渲染侧边栏:horizontal / sidebar 有,top 无。 */
const hasSidebar = computed(() => layout.value !== 'top') const hasSidebar = computed(() => layout.value !== 'top')
@ -44,7 +41,6 @@ export const useAppStore = defineStore(
showTabs, showTabs,
showFullscreen, showFullscreen,
menuAccordion, menuAccordion,
hasHeader,
hasSidebar, hasSidebar,
hasMixbar, hasMixbar,
} }

File diff suppressed because one or more lines are too long