2026-03-20 19:01:14 +08:00

31 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# App.vue
**路径**`src/App.vue`
## 功能用途
根组件,包含全局 AppBar、主内容区router-view。AppBar 含返回按钮、标题、登录/余额/头像入口,主内容区使用 keep-alive 缓存 Home。
## 核心能力
- 顶部导航栏返回、TestMarket 标题、Login 或余额+头像入口
- 头像入口:登录态点击头像直接跳转 `/profile`
- 移动端底部导航Home / Search / Mine三个 tab 等分屏宽与路由联动Mine 点击跳转 `/profile`;选中态仅加粗、无底色;未选中项图标与文字偏灰;底部导航上方有淡投影);仅在 `/``/search``/profile` 三个主页面显示,其他页面隐藏
- 内部滚动:`html`/`body``.v-application` 禁止滚动;`app-main-scroll``data-main-scroll`)作为主滚动容器,`overflow-y: auto`,滚动条仅出现在内容区,不覆盖底部导航
- 登录态:`userStore.isLoggedIn` 控制展示
- 用户名:`nickName``userName` 显示在头像左侧(有值时)
- 挂载时与 `isLoggedIn` 变为 true 时:拉取用户信息与余额(`router.isReady()` + `nextTick` 后执行),确保钱包登录、刷新页面后头像和用户名正确显示
- keep-alive`include="['Home']"` 缓存首页
## 使用方式
- 启动应用后由 `App.vue` 承载顶栏、主内容与底部导航
- 路由切换时由 `bottomNavValue` 自动同步 Home / Search / Mine 高亮状态
- 页面内容通过 `<router-view>` 渲染Home 页面使用 keep-alive 缓存
## 扩展方式
1. **多级导航**:根据路由深度调整返回逻辑
2. **主题切换**:增加亮/暗模式切换
3. **个人入口扩展**:可在个人中心页继续扩展设置项与账户操作