后端接口选项没有全部选中的选项,自己添加一个。
allData:[
{
value:"-1",
label:"全部",
}
],
从后端取得的数据
//仓库收货地下拉框
getWarehouseDDl() {
this.axios.get("StoreRoom/GetDDLStoreRoom").then((res) => {
this.ReceiptDDL = this.allData.concat(res.data.data); //allData与接收的数组合并
console.log(this.ReceiptDDL);
this.orderForm.Receipt = this.ReceiptDDL[0].value;//显示默认值
});
},
value的 值不能是int类型,不然下拉框不能够显示对应的label. 加一个 + ‘ ’自动转string
//获取详情
getDetailPeople () {
let userCode = {
Code: this.uCode
};
this.axios.post("User/GetUser", userCode).then((res) => {
console.log(res.data);
let tempData = res.data.data;
this.editForm = tempData;
this.editForm.u_level = this.editForm.u_level + '';//int转string
})
},