或者重新建一個[] 然後重新push ...
var keyMap = { deviceUid: "id", deviceType: "typeName", deviceCode: "code", deviceName: "name", deviceStatus: "status" }; for (var i = 0; i < data.confList.length; i++) { var obj = data.confList[i]; for (var key in obj) { var newKey = keyMap[key]; if (newKey) { obj[newKey] = obj[key]; delete obj[key]; } } } console.log("array", data.confList);
或者重新建一個[]
然後重新push
let itemArr = []; this.deviceTableData_ys_true.map(item => { itemArr.push({ deviceUid: item.id, deviceId: item.deviceId }); });