Files
easygoadmin-wiki/EasyGoAdmin_Gin_NaiveVue/zh/appendix/stores.md
T
2026-10-25 17:24:27 +08:00

37 lines
1.3 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.
# I. 前端 Store 速查
:::tip 说明
Pinia 7 个 store 模块速查。storage 键统一在 `store/mutation-types.ts` 定义常量。
:::
## 模块清单
| Store | 主要 state | 主要 getter/action |
|---|---|---|
| user | token、用户信息、权限集合 | getPermissions、setToken、GetInfo |
| asyncRoute | 菜单树、动态路由表、注入标记 | generateRoutes、setDynamicAddedRoute、getIsDynamicAddedRoute |
| tabsView | 标签页列表、当前页签 | 多页签增删切换(经 storage 持久化) |
| designSetting | 主题配色、布局尺寸、组件大小 | 主题切换即时生效(持久化) |
| projectSetting | 项目开关(水印/锁屏/面包屑等) | 设置项读写 |
| lockscreen | 锁屏状态 | 锁定/解锁 |
| ossConfig | 对象存储配置 | 直传场景配置读取 |
## mutation-types(storage 键)
| 常量 | 用途 |
|---|---|
| ACCESS_TOKEN | 登录令牌 |
| FIRST_ROUTE | 首个落地路由 |
| (其他) | 主题、标签页、锁屏等持久化键 |
## 使用规约速记
- `useXxxStore()` 组件内获取;`useXxxStoreWidthOut()` 守卫等组件外场景
- 权限集合只读(登录后装配)
- 页面局部状态不进 store
- 新增持久化键先在 mutation-types 登记
## 相关
- [9.6 状态管理(Pinia)](/zh/frontend/store.html)