This commit is contained in:
吴红兵
2026-03-05 15:00:19 +08:00
parent bff8907f88
commit 2317909261
9 changed files with 397 additions and 348 deletions

View File

@@ -8,6 +8,7 @@
Vue 3 SPA with custom composables for data fetching. Element Plus for UI.
## Structure
```
cloud-ui/src/
├── api/ # API modules (one per entity)
@@ -23,15 +24,16 @@ cloud-ui/src/
## Key Hooks
| Hook | Purpose |
|------|---------|
| `useDict(type1, type2)` | Dictionary data with caching |
| `useTable({ pageList, queryForm })` | Table + pagination |
| `useMessage()` | Toast notifications |
| `useMessageBox()` | Confirm dialogs |
| `useParam(type)` | System parameters |
| Hook | Purpose |
| ----------------------------------- | ---------------------------- |
| `useDict(type1, type2)` | Dictionary data with caching |
| `useTable({ pageList, queryForm })` | Table + pagination |
| `useMessage()` | Toast notifications |
| `useMessageBox()` | Confirm dialogs |
| `useParam(type)` | System parameters |
## API Pattern
```typescript
import request from '/@/utils/request';
@@ -43,6 +45,7 @@ export const delObj = (id) => request.post('/module/entity/delete', id);
```
## Hooks Usage
```typescript
// Dictionary
const { dict } = useDict('sex', 'status');
@@ -50,8 +53,8 @@ const { dict } = useDict('sex', 'status');
// Table
const { tableData, loading, getData, pagination } = useTable({
pageList: fetchList,
queryForm: reactive({ name: '' })
pageList: fetchList,
queryForm: reactive({ name: '' }),
});
// Message
@@ -65,16 +68,17 @@ await msgBoxConfirm('确定删除?');
## Constraints
| Rule | Details |
|------|---------|
| **Hardcoding** | NO hardcoded strings. Define constants first. |
| **Line width** | 150 chars (Prettier) |
| **Indentation** | Tabs (Prettier) |
| **Quotes** | Single quotes |
| **API updates** | POST /edit (NOT PUT) |
| **API deletes** | POST /delete (NOT DELETE) |
| Rule | Details |
| --------------- | --------------------------------------------- |
| **Hardcoding** | NO hardcoded strings. Define constants first. |
| **Line width** | 150 chars (Prettier) |
| **Indentation** | Tabs (Prettier) |
| **Quotes** | Single quotes |
| **API updates** | POST /edit (NOT PUT) |
| **API deletes** | POST /delete (NOT DELETE) |
## Commands
```bash
npm run dev # Development server
npm run build # Production build
@@ -84,17 +88,18 @@ npm run prettier # Format code
## Non-Standard
| Location | Issue |
|----------|-------|
| `src/composables/` + `src/hooks/` | Both exist (prefer hooks/) |
| `src/directive/` + `src/directives/` | Both exist |
| `src/const/` | Named "const" not "constants" |
| Location | Issue |
| ------------------------------------ | ----------------------------- |
| `src/composables/` + `src/hooks/` | Both exist (prefer hooks/) |
| `src/directive/` + `src/directives/` | Both exist |
| `src/const/` | Named "const" not "constants" |
## ESLint Relaxed Rules
Many TypeScript rules are OFF:
- `@typescript-eslint/no-explicit-any`: OFF
- `@typescript-eslint/explicit-function-return-type`: OFF
- `vue/require-default-prop`: OFF
Follow existing patterns in codebase.
Follow existing patterns in codebase.