let filteredData = this.list.map((item) => { const updatedItem = { ...item }; // Create a shallow copy of the item // Remove createTime and updateTime properties delete updatedItem.createTime; delete updatedItem.updateTime; // If inOutboundList exists, remove its createTime and updateTime properties if (updatedItem.inOutboundList) { delete updatedItem.inOutboundList.createTime; delete updatedItem.inOutboundList.updateTime; } return updatedItem; }); console.log(filteredData); inOutboundList里面的没有删除掉
时间: 2024-02-14 10:28:05 浏览: 61
根据您提供的代码,问题可能出在删除 `inOutboundList` 属性的代码块中。请确保在删除 `inOutboundList` 属性的同时,也删除了其中的 `createTime` 和 `updateTime` 属性。您可以尝试以下代码:
```javascript
let filteredData = this.list.map((item) => {
const updatedItem = { ...item }; // Create a shallow copy of the item
// Remove createTime and updateTime properties
delete updatedItem.createTime;
delete updatedItem.updateTime;
// If inOutboundList exists, remove its createTime and updateTime properties
if (updatedItem.inOutboundList) {
delete updatedItem.inOutboundList.createTime;
delete updatedItem.inOutboundList.updateTime;
}
return updatedItem;
});
console.log(filteredData);
```
请确保以上代码中的 `delete` 语句正确删除了属性,并且在控制台输出 `filteredData` 之后,检查 `inOutboundList` 中的属性是否已被正确删除。如果问题仍然存在,请提供更多关于 `this.list` 数据的信息,以便我能够更好地帮助您解决问题。
阅读全文