签入版本
This commit is contained in:
@@ -141,14 +141,11 @@ export function getDictItemByCode(code) {
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<el-select v-model="formData.status" placeholder="请选择状态">
|
||||
<el-option
|
||||
v-for="item in statusOptions"
|
||||
:key="item.value"
|
||||
:label="item.name"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<n-select
|
||||
v-model:value="formData.status"
|
||||
:options="statusOptions"
|
||||
placeholder="请选择状态"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -158,7 +155,9 @@ import { getDictItemByCode } from '@/api/common/index';
|
||||
const statusOptions = ref([]);
|
||||
|
||||
onMounted(async () => {
|
||||
statusOptions.value = await getDictItemByCode('example_status');
|
||||
const list = await getDictItemByCode('example_status');
|
||||
// n-select 的 options 需要 { label, value } 结构
|
||||
statusOptions.value = list.map((item) => ({ label: item.name, value: item.value }));
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user