Element Select 选择器显示 value 而不是 label,可能是因为返回值的数据类型不匹配,需要转成Number类型。
比如当数据库返回的 value 是 bigint 类型时就不能自动匹配,如果是 varchar 类型就能自动匹配显示对应的 label 值。
this.dataForm.custId = Number(this.dataForm.custId)
如果要获取选择器的label值,可以在 el-select 选择器上添加一个change方法
@change="custInfoChange"
custInfoChange (val) {
let obj = {}
obj = this.custInfoList.find((item) => {
return item.id === val
})
this.dataForm.custNm = obj.custNm
},