问题已搞定,浅拷贝的问题。
这是什么情况!- 当前 Bug 的表现(可附上截图)[图片] - 预期表现 数组setData更新数据会覆盖前面元素 - 复现路径 setData - 提供一个最简复现 Demo setData内容{"listData[0]":{"id":0,"code":"pdtid","text":"产品编号:","type":"text","value":"","isdisplay":true},"listData[0].id":0,"listData[0].value":"w11111-1","listData[1]":{"id":0,"code":"pdtname","text":"产品名称:","type":"text","value":"","isdisplay":true},"listData[1].id":0,"listData[1].value":"产品1-1","listData[2]":{"id":0,"code":"anticode","text":"溯源码:","type":"number","value":"","isdisplay":false},"listData[2].id":0,"listData[3]":{"id":0,"code":"remark","text":"异常备注:","type":"text","value":"","isdisplay":false},"listData[3].id":0,"listData[4]":{"id":0,"code":"pdtid","text":"产品编号:","type":"text","value":"","isdisplay":true},"listData[4].id":1,"listData[4].value":"w11111-2","listData[5]":{"id":0,"code":"pdtname","text":"产品名称:","type":"text","value":"","isdisplay":true},"listData[5].id":1,"listData[5].value":"产品1-2","listData[6]":{"id":0,"code":"anticode","text":"溯源码:","type":"number","value":"","isdisplay":false},"listData[6].id":1,"listData[7]":{"id":0,"code":"remark","text":"异常备注:","type":"text","value":"","isdisplay":false},"listData[7].id":1} pdtadd.js? [sm]:170 listData的值[{"id":1,"code":"pdtid","text":"产品编号:","type":"text","value":"w11111-2","isdisplay":true},{"id":1,"code":"pdtname","text":"产品名称:","type":"text","value":"产品1-2","isdisplay":true},{"id":1,"code":"anticode","text":"溯源码:","type":"number","value":"","isdisplay":false},{"id":1,"code":"remark","text":"异常备注:","type":"text","value":"","isdisplay":false},{"id":1,"code":"pdtid","text":"产品编号:","type":"text","value":"w11111-2","isdisplay":true},{"id":1,"code":"pdtname","text":"产品名称:","type":"text","value":"产品1-2","isdisplay":true},{"id":1,"code":"anticode","text":"溯源码:","type":"number","value":"","isdisplay":false},{"id":1,"code":"remark","text":"异常备注:","type":"text","value":"","isdisplay":false}] console.log("setData内容" + JSON.stringify(param)); this.setData(param); console.log("listData的值" + JSON.stringify(that.data.listData));
2019-02-16