fix(frontend): 修复移动端菜单栏和使用记录页面 UI 问题

- 修复移动端无法打开菜单栏的问题
  - 在 app.ts 中添加 mobileOpen 状态管理
  - 修复 AppHeader.vue 中移动端菜单按钮调用错误的方法
  - 修复 AppSidebar.vue 使用本地 ref 而非全局状态的问题

- 添加移动端菜单自动关闭功能
  - 点击菜单项后自动关闭侧边栏
  - 添加 150ms 延迟以显示关闭动画

- 修复使用记录页面总消费卡片溢出问题
  - 调整总消费卡片布局,将删除线价格移至说明行
  - 添加 min-w-0 flex-1 防止内容溢出
  - 保持与其他卡片高度一致

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
dexcoder6
2025-12-19 15:55:42 +08:00
parent 463ddea36f
commit 406d3f3cab
5 changed files with 43 additions and 15 deletions

View File

@@ -12,6 +12,7 @@ export const useAppStore = defineStore('app', () => {
// ==================== State ====================
const sidebarCollapsed = ref<boolean>(false);
const mobileOpen = ref<boolean>(false);
const loading = ref<boolean>(false);
const toasts = ref<Toast[]>([]);
@@ -50,6 +51,21 @@ export const useAppStore = defineStore('app', () => {
sidebarCollapsed.value = collapsed;
}
/**
* Toggle mobile sidebar open state
*/
function toggleMobileSidebar(): void {
mobileOpen.value = !mobileOpen.value;
}
/**
* Set mobile sidebar open state explicitly
* @param open - Whether mobile sidebar should be open
*/
function setMobileOpen(open: boolean): void {
mobileOpen.value = open;
}
/**
* Set global loading state
* @param isLoading - Whether app is in loading state
@@ -257,6 +273,7 @@ export const useAppStore = defineStore('app', () => {
return {
// State
sidebarCollapsed,
mobileOpen,
loading,
toasts,
@@ -275,6 +292,8 @@ export const useAppStore = defineStore('app', () => {
// Actions
toggleSidebar,
setSidebarCollapsed,
toggleMobileSidebar,
setMobileOpen,
setLoading,
showToast,
showSuccess,