多选和默认
<a-form-item label="选择仓库" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select v-decorator="['WarehouseId', { rules: [{ required: true ,message:'请选择'}],initialValue: warhousecollection[0].Id }]">
<a-select-option v-for="d in warhousecollection" :key="d.Id" :value="d.Id">{{d.Warehouse}}</a-select-option>
</a-select>
</a-form-item>
mounted() {
this.loading = true
this.$http.get('/BaseWarehouse/T_Warehouse/GetDataListAll').then(resJson => {
this.loading = false
if (resJson.Success) {
//this.$message.success('操作成功!')
this.warhousecollection=resJson.Data
// this.form.setFieldsValue({
// "WarehouseId": this.warhousecollection[0],
// })
} else {
this.$message.error(resJson.Msg)
this.warhousecollection = null
}
})
}
来源:oschina
链接:https://my.oschina.net/u/4390329/blog/4261983