fix(web-admin): 顶栏菜单折叠按钮改为内联 SVG 并始终可见。
避免 Iconify/el-icon 在部分浏览器不绘制,并去掉可关闭开关以免按钮被关掉。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
8ac835fa96
commit
82c21262ed
9 files changed
+143
-31
No files matched your search
@@ -1,11 +1,11 @@
|
||||
<!-- 图标组件:支持 Element Plus 图标(无 : 前缀)与 Iconify 图标(含 : 前缀) -->
|
||||
<template>
|
||||
<!-- el-icon 勿加 Tailwind `inline`:生产 CSS 中 `.inline{display:inline}` 会覆盖
|
||||
`.el-icon{display:inline-flex}`,导致 Fold 等图标在打包后不可见 -->
|
||||
<!-- 勿给图标根节点加 Tailwind `inline`:生产 CSS 中 `.inline{display:inline}`
|
||||
会覆盖 flex/尺寸,部分 Chrome 下 Fold 等图标不可见 -->
|
||||
<el-icon v-if="epIcon" v-bind="iconAttrs" class="art-svg-icon">
|
||||
<component :is="epIcon" />
|
||||
</el-icon>
|
||||
<Icon v-else-if="icon" :icon="icon" v-bind="iconAttrs" class="art-svg-icon inline" />
|
||||
<Icon v-else-if="icon" :icon="icon" v-bind="iconAttrs" class="art-svg-icon" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
@@ -21,17 +21,31 @@
|
||||
@click="toHome"
|
||||
/>
|
||||
|
||||
<!-- 菜单按钮 -->
|
||||
<ArtIconButton
|
||||
<!-- 菜单按钮:内联 SVG,避开 Chrome 下 el-icon / Iconify 偶发不绘制 -->
|
||||
<button
|
||||
v-if="isLeftMenu && shouldShowMenuButton"
|
||||
icon="fold"
|
||||
class="ml-3 max-sm:ml-[7px] menu-fold-btn"
|
||||
type="button"
|
||||
class="menu-fold-btn"
|
||||
:class="{ 'is-menu-collapsed': !menuOpen }"
|
||||
:title="menuOpen ? '收起菜单' : '展开菜单'"
|
||||
:aria-label="menuOpen ? '收起菜单' : '展开菜单'"
|
||||
:aria-expanded="menuOpen"
|
||||
@click="visibleMenu"
|
||||
/>
|
||||
>
|
||||
<svg
|
||||
class="menu-fold-btn__icon"
|
||||
viewBox="0 0 24 24"
|
||||
width="20"
|
||||
height="20"
|
||||
aria-hidden="true"
|
||||
focusable="false"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M21 18v2H3v-2zm0-5v2h-9v-2zm0-5v2h-9V8zM3 3.5v10l5-5z"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<!-- 刷新按钮 - 已隐藏 -->
|
||||
<ArtIconButton
|
||||
@@ -388,14 +402,49 @@
|
||||
}
|
||||
}
|
||||
|
||||
.menu-fold-btn :deep(.art-svg-icon) {
|
||||
transition: transform 0.3s ease;
|
||||
/* 顶栏折叠按钮:原生 button + 内联 SVG,保证 Chrome/Safari 一致可见 */
|
||||
.menu-fold-btn {
|
||||
box-sizing: border-box;
|
||||
display: inline-flex;
|
||||
flex-shrink: 0;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
margin-left: 12px;
|
||||
padding: 0;
|
||||
color: #64748b;
|
||||
cursor: pointer;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
border-radius: 8px;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
.menu-fold-btn.is-menu-collapsed :deep(.art-svg-icon) {
|
||||
@media (max-width: 640px) {
|
||||
.menu-fold-btn {
|
||||
margin-left: 7px;
|
||||
}
|
||||
}
|
||||
|
||||
.menu-fold-btn:hover {
|
||||
color: #1e293b;
|
||||
background: var(--mint-row-alt, #f1f5f9);
|
||||
}
|
||||
|
||||
.menu-fold-btn__icon {
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
transition: transform 0.3s ease;
|
||||
/* 展开态默认旋转,与收起态对调 */
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.menu-fold-btn.is-menu-collapsed .menu-fold-btn__icon {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
/* Hover animation classes */
|
||||
.refresh-btn:hover :deep(.art-svg-icon) {
|
||||
animation: rotate180 0.5s;
|
||||
|
||||
+1
-7
@@ -119,13 +119,7 @@ export function useSettingsConfig() {
|
||||
handler: 'uniqueOpened',
|
||||
headerBarKey: null // 不依赖headerBar配置
|
||||
},
|
||||
{
|
||||
key: 'showMenuButton',
|
||||
label: t('setting.basics.list.collapseSidebar'),
|
||||
type: 'switch' as const,
|
||||
handler: 'menuButton',
|
||||
headerBarKey: 'menuButton' as const
|
||||
},
|
||||
// showMenuButton 不提供开关:顶栏收起侧栏按钮为产品必显能力
|
||||
{
|
||||
key: 'showFastEnter',
|
||||
label: t('setting.basics.list.fastEnter'),
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ export function useSettingsHandlers() {
|
||||
uniqueOpened: createToggleHandler(() => settingStore.setUniqueOpened()),
|
||||
|
||||
// 显示菜单按钮
|
||||
menuButton: createToggleHandler(() => settingStore.setButton()),
|
||||
menuButton: createToggleHandler(() => settingStore.ensureMenuButtonVisible()),
|
||||
|
||||
// 显示快速入口
|
||||
fastEnter: createToggleHandler(() => settingStore.setFastEnter()),
|
||||
|
||||
@@ -185,9 +185,8 @@
|
||||
settingStore.setElementTheme(config.systemThemeColor)
|
||||
|
||||
// 界面显示(切换类方法)
|
||||
toggleIfDifferent(settingStore.showMenuButton, config.showMenuButton, () =>
|
||||
settingStore.setButton()
|
||||
)
|
||||
// 顶栏收起按钮为必显,导入配置时也强制打开
|
||||
settingStore.ensureMenuButtonVisible()
|
||||
toggleIfDifferent(settingStore.showFastEnter, config.showFastEnter, () =>
|
||||
settingStore.setFastEnter()
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user