docs: update LLM guides for models and layout rules
Document new GUIDE.md expectations for src-layer edits and add index entries for models and shared types. Clarify layout usage, composable placement, error page conventions, and model/type ownership so future changes follow the intended layer boundaries.docs: update LLM guides for models and layout rules Document new GUIDE.md expectations for src-layer edits and add index entries for models and shared types. Clarify layout usage, composable placement, error page conventions, and model/type ownership so future changes follow the intended layer boundaries.
This commit is contained in:
+26
-3
@@ -23,9 +23,32 @@ meta: { layout: 'default' }
|
||||
meta: { layout: 'none' }
|
||||
```
|
||||
|
||||
## Auth Meta
|
||||
|
||||
| Meta | 效果 |
|
||||
|------|------|
|
||||
| `requiresAuth: true` | 未登入時導向 login,附 `redirect` query |
|
||||
| `guestOnly: true` | 已登入時導向 home(含 `VITE_SKIP_LOGIN` 啟用時) |
|
||||
| `roles: string[]` | RBAC,缺任一角色時導向 `/403` |
|
||||
|
||||
以上 meta 只在 `registerGuards` 中消費,不要在 component 裡重複檢查。
|
||||
|
||||
## 錯誤頁路由慣例
|
||||
|
||||
錯誤頁(403/500/503/network/maintenance/not-found)統一使用:
|
||||
|
||||
```ts
|
||||
meta: { title: 'Forbidden', layout: 'none' }
|
||||
```
|
||||
|
||||
- `layout: 'none'` 使頁面不被 `MainLayout` 包住,自己獨立渲染。
|
||||
- catch-all `/:pathMatch(.*)*` 放在路由陣列最後。
|
||||
- 錯誤頁 view 通常使用 `ErrorShell.vue` 共用組件,只傳入 props,不用重複寫佈局。
|
||||
|
||||
## Guards
|
||||
|
||||
- 登入需求使用既有 `requiresAuth` meta。
|
||||
- 訪客專用頁使用既有 `guestOnly` meta。
|
||||
- guard 流程放在 `guards.ts`,不要散落在 view/component。
|
||||
- catch-all route 保持在最後。
|
||||
- `beforeEach`:登入檢查、RBAC、`VITE_SKIP_LOGIN` 跳過。
|
||||
- `beforeResolve`:輕量前置工作(例如進度條)。
|
||||
- `afterEach`:document title、追蹤。
|
||||
- `onError`:chunk load 失敗等。
|
||||
|
||||
Reference in New Issue
Block a user