2 回答

TA貢獻(xiàn)1780條經(jīng)驗(yàn) 獲得超1個(gè)贊
掛起的密鑰會(huì)以這種方式丟失
set = {
pending: set.pending.filter(({ po_id }) => { return po_id === 'm86lu'; })
}

TA貢獻(xiàn)2003條經(jīng)驗(yàn) 獲得超2個(gè)贊
循環(huán)遍歷json,根據(jù)評(píng)論的建議一一添加到新集合中。
var input = {
"pending": [
{
"is_active": true,
"order_updated": false,
"po_id": "m86lu",
}, {
"is_active": true,
"order_updated": false,
"po_id": "m86lu",
}, {
"is_active": true,
"order_updated": false,
"po_id": "m86l89u",
}]}
var output = {};
for (var key in input) {
if (!input.hasOwnProperty(key)) {
continue;
}
let content = input[key].filter(({ po_id }) => { return po_id === 'm86lu'; });
output[key] = content;
}
console.log(output);
添加回答
舉報(bào)