docs(VUE_CODE_STYLE_GUIDE): 更新代码风格指南中用户态处理说明
调整用户态单一事实来源的说明,明确已通过封装函数实现持久化镜像处理
Showing
1 changed file
with
1 additions
and
1 deletions
| ... | @@ -191,7 +191,7 @@ Vue 官方建议在 SFC + Composition API 场景使用 `<script setup>`,因为 | ... | @@ -191,7 +191,7 @@ Vue 官方建议在 SFC + Composition API 场景使用 `<script setup>`,因为 |
| 191 | - 现有风险:部分页面写法是 `if (res.code) { ... }`,当 `code=401` 等非 0 值时会被当成“成功”分支;建议统一改成 `if (res.code === 1)`。 | 191 | - 现有风险:部分页面写法是 `if (res.code) { ... }`,当 `code=401` 等非 0 值时会被当成“成功”分支;建议统一改成 `if (res.code === 1)`。 |
| 192 | - 现有风险:`qs` 的包名是小写 `qs`,但当前存在 `import qs from 'Qs'` 写法,在大小写敏感环境下可能无法解析(建议统一为 `qs`)。 | 192 | - 现有风险:`qs` 的包名是小写 `qs`,但当前存在 `import qs from 'Qs'` 写法,在大小写敏感环境下可能无法解析(建议统一为 `qs`)。 |
| 193 | 193 | ||
| 194 | -2) 收敛“用户态”的单一事实来源:context/store 负责运行时,localStorage 负责持久化镜像 | 194 | +2) 收敛“用户态”的单一事实来源:context/store 负责运行时,localStorage 负责持久化镜像 (已做调整,在auth_user_info.js里面使用了getUserInfoFromStorage和removeUserInfoFromStorage函数做了封装) |
| 195 | 195 | ||
| 196 | - 目标:避免 `currentUser`、`user_info`、请求头三套来源互相覆盖导致的“偶发态” | 196 | - 目标:避免 `currentUser`、`user_info`、请求头三套来源互相覆盖导致的“偶发态” |
| 197 | - 涉及文件:[auth.js](file:///Users/huyirui/program/itomix/git/mlaj/src/contexts/auth.js)、[axios.js](file:///Users/huyirui/program/itomix/git/mlaj/src/utils/axios.js) | 197 | - 涉及文件:[auth.js](file:///Users/huyirui/program/itomix/git/mlaj/src/contexts/auth.js)、[axios.js](file:///Users/huyirui/program/itomix/git/mlaj/src/utils/axios.js) | ... | ... |
-
Please register or login to post a comment