1、经常遇到下拉框的数据是后台返回的,此时可以使用v-for遍历即可
<a-form-item name="newChangeType" label="变动类型" labelAlign="right">
<a-select
v-model:value="formState.newChangeType"
placeholder="请选择变动类型"
autocomplete="off"
@change="changeType"
>
<a-select-option v-for="(item, index) in treeData" :key="index" :value="item.key">
{
{ item.value }}
</a-select-option>
</a-select>
</a-form-item>
const treeData = ref<any>([]);
onMounted(() => {
changeCategory().then((res) => {
treeData.value = res;
});
});