签入版本
This commit is contained in:
@@ -206,14 +206,16 @@ export function getDictItemList(code: string) {
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<el-select v-model="formData.status" placeholder="请选择状态">
|
||||
<el-option
|
||||
<a-select v-model:value="formData.status" placeholder="请选择状态" allow-clear>
|
||||
<a-select-option
|
||||
v-for="item in statusOptions"
|
||||
:key="item.value"
|
||||
:label="item.name"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
:label="item.name"
|
||||
>
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -240,8 +242,12 @@ const [genderOptions, statusOptions] = await Promise.all([
|
||||
|
||||
### 封装为通用 Hook
|
||||
|
||||
:::warning 说明
|
||||
`ui/src/hooks/web/useDict.ts` 当前项目中尚不存在,以下为建议的封装写法,可按需自行创建。
|
||||
:::
|
||||
|
||||
```typescript
|
||||
// ui/src/hooks/web/useDict.ts
|
||||
// ui/src/hooks/web/useDict.ts(自行创建)
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { getDictItemList } from '@/api/common/index';
|
||||
|
||||
@@ -272,9 +278,9 @@ const { options: statusOptions } = useDict('user_status');
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<el-tag :type="row.status === 1 ? 'success' : 'danger'">
|
||||
<a-tag :color="row.status === 1 ? 'success' : 'error'">
|
||||
{{ row.statusText }}
|
||||
</el-tag>
|
||||
</a-tag>
|
||||
</template>
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user