<a-row>
<a-col :span="8">
<a-form-item label="项目类型" :labelCol="{ span: 3 }" :wrapperCol="{ span: 20, offset: 1 }">
<a-select placeholder="请选择项目类型"
v-decorator="['type', { rules: [{ required: false, message: '请选择项目类型' }] }]" :options="typeList">
</a-select>
</a-form-item>
</a-col>
</a-row>
引入字典接口js文件
import { getDictSearch } from '@/services/systemManage'
在data中返回设置的数组,然后在methods中实现该接口
data(){
return{
typeList:[]
}
},
methods:{
getDict(){
getDictSearch('XMLX').then(res => {
let options = []
res.data.map(i=>{
let obj = {
title: i.label,
value: i.value
}
options.push(obj)
})
this.typeList = options
console.log(this.typeList)
}).catch(error => {
console.error(error);
});
}
},
mounted() {
//this.getDictValList()
this.getDict()
}