vue+elementui编辑问题bug

1.需求

a. 基本信息默认展示8项,当8项填写完值,在点击编辑,现在新增的选项,选中几个页面显示几个。

b.实现思路

后台返回默认字段是数组里一个个对象list,编辑弹框选中字段也是数组里一个个对象arr,分别抽取list和arr里某个对象属性。

得list1和arr1。遍历list1:

arr2.forEach((item, index) => {
        if (list2.indexOf(item) !== -1) {
          list.forEach((item2, index2) => {
            if (item === item2.ttConditionColumn.qttccName) {
              arrInfo.push(item2) // 相同元素保留
            }
          })
        } else {
          arrInfo.push(arr[index]) // 不同元素
        }
      })
list = JSON.parse(JSON.stringify(arrInfo)) //数组赋值

得到arrInfo原来默认字段保留相同元素对象,不同元素在编辑选中数组对象中获取

你可能感兴趣的:(vue+elementui编辑问题bug)