解决element ui select多选下拉框编辑时没有回显数据

我们直接从编辑的数据拿id分割成数组是不行的,只会显示id

正确做法:应该再遍历一下,主要是字符转数字 ,重点乘以1

    let jsonList = data.CharacteristicId.split(',')
            let list = []
            for(let i in jsonList){
              list.push(jsonList[i]*1)
            }
            this.ruleForm.characteristicEdit = list

如果是单个字符串直接Number

  this.form = this.selectedColumns[0]
            this.form.DriverId = Number(this.form.DriverId)

你可能感兴趣的:(前端,javascript,elementui)