Skip to content

Commit ebaff24

Browse files
committed
修复:在MainLayout.vue中优化移动端导航抽屉,使用FlyonUI的标准组件,添加无障碍属性;在ModelManager.vue中新增移动端筛选按钮。
1 parent 6c4868d commit ebaff24

File tree

2 files changed

+45
-40
lines changed

2 files changed

+45
-40
lines changed

frontend/src/pages/MainLayout.vue

Lines changed: 27 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -66,32 +66,44 @@
6666
type="button"
6767
class="btn btn-icon btn-outline md:hidden"
6868
title="菜单"
69-
@click="toggleMobileMenu"
69+
aria-haspopup="dialog"
70+
aria-expanded="false"
71+
aria-controls="mobile-drawer"
72+
data-overlay="#mobile-drawer"
7073
>
7174
<span class="icon-[tabler--menu] size-5"></span>
7275
</button>
7376
</div>
7477
</div>
7578
</header>
7679

77-
<!-- 移动端导航抽屉 -->
80+
<!-- 移动端导航抽屉 (使用Flyonui的drawer组件) -->
7881
<div
79-
class="drawer-side z-20 md:hidden"
80-
:class="{ 'drawer-open': mobileMenuOpen }"
82+
id="mobile-drawer"
83+
class="overlay overlay-open:translate-x-0 drawer drawer-start hidden md:hidden"
84+
role="dialog"
85+
tabindex="-1"
8186
>
82-
<label
83-
class="drawer-overlay"
84-
@click="mobileMenuOpen = false"
85-
></label>
86-
<div class="p-4 w-60 min-h-full bg-base-200 text-base-content">
87+
<div class="drawer-header">
88+
<h3 class="drawer-title">导航菜单</h3>
89+
<button
90+
type="button"
91+
class="btn btn-text btn-circle btn-sm absolute end-3 top-3"
92+
aria-label="关闭"
93+
data-overlay="#mobile-drawer"
94+
>
95+
<span class="icon-[tabler--x] size-5"></span>
96+
</button>
97+
</div>
98+
<div class="drawer-body">
8799
<div class="flex flex-col gap-2">
88100
<router-link
89101
to="/models"
90102
class="btn"
91103
:class="[
92104
isModelPage ? 'btn-primary' : 'btn-ghost'
93105
]"
94-
@click="mobileMenuOpen = false"
106+
data-overlay="#mobile-drawer"
95107
>
96108
<span class="icon-[tabler--database] inline-block me-1.5 size-5"></span>
97109
模型管理
@@ -102,14 +114,17 @@
102114
:class="[
103115
isPromptPage ? 'btn-primary' : 'btn-ghost'
104116
]"
105-
@click="mobileMenuOpen = false"
117+
data-overlay="#mobile-drawer"
106118
>
107119
<span class="icon-[tabler--message-circle] inline-block me-1.5 size-5"></span>
108120
提示词管理
109121
</router-link>
110122
<!-- 这里可以添加更多导航项 -->
111123
</div>
112124
</div>
125+
<div class="drawer-footer">
126+
<button type="button" class="btn btn-soft btn-secondary" data-overlay="#mobile-drawer">关闭</button>
127+
</div>
113128
</div>
114129

115130
<!-- 页面内容区 -->
@@ -151,11 +166,6 @@ const appVersion = ref('');
151166
const modelPath = ref('');
152167
const settingsModalRef = ref<InstanceType<typeof SettingsModal> | null>(null);
153168
154-
// 切换移动端菜单
155-
function toggleMobileMenu() {
156-
mobileMenuOpen.value = !mobileMenuOpen.value;
157-
}
158-
159169
// 切换暗色模式
160170
function toggleDarkMode() {
161171
darkMode.value = !darkMode.value;
@@ -219,26 +229,5 @@ onMounted(async () => {
219229
</script>
220230

221231
<style>
222-
.drawer-side {
223-
position: fixed;
224-
top: 0;
225-
left: -100%;
226-
width: 100%;
227-
height: 100%;
228-
transition: left 0.3s ease;
229-
}
230-
231-
.drawer-side.drawer-open {
232-
left: 0;
233-
}
234-
235-
.drawer-overlay {
236-
position: fixed;
237-
top: 0;
238-
left: 0;
239-
width: 100%;
240-
height: 100%;
241-
background-color: rgba(0, 0, 0, 0.5);
242-
z-index: -1;
243-
}
232+
/* 不再需要自定义抽屉样式,使用FlyonUI标准抽屉组件 */
244233
</style>

frontend/src/pages/ModelManager.vue

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@
1313
<div class="flex flex-wrap items-center justify-between gap-2">
1414
<h1 class="text-xl font-semibold">模型管理</h1>
1515
<div class="flex gap-2">
16+
<!-- 新增移动端筛选按钮,仅在非大屏显示 -->
17+
<button
18+
type="button"
19+
class="btn btn-outline btn-sm md:btn-md lg:hidden"
20+
title="筛选器"
21+
@click="openFilterSidebar"
22+
>
23+
<span class="icon-[tabler--filter] size-5"></span>
24+
<span class="hidden md:inline ml-2">筛选</span>
25+
</button>
26+
1627
<button
1728
type="button"
1829
:class="[
@@ -199,8 +210,6 @@ function toggleBlurNsfw() {
199210
localStorage.setItem('blurNsfw', String(blurNsfw.value));
200211
}
201212
202-
203-
204213
const scanModels = async () => {
205214
try {
206215
// 清除可能的上一个轮询间隔
@@ -338,4 +347,11 @@ onUnmounted(() => {
338347
scanInterval = null;
339348
}
340349
});
350+
351+
// 打开筛选器侧边栏
352+
function openFilterSidebar() {
353+
if (filterSidebarRef.value) {
354+
filterSidebarRef.value.openFilterSidebar();
355+
}
356+
}
341357
</script>

0 commit comments

Comments
 (0)