var arr =[ {op: "danmaku", text: "大师傅是对方", uid: "1", name: "看看"}, {op: "danmaku", text: "三顿饭地方发", uid: "1", name: "流量"}, {op: "danmaku", text: "徐州持续催促", uid: "2", name: "看看"}, {op: "danmaku", text: "大师傅是对方", uid: "1", name: "看看"}, {op: "danmaku", text: "大是否都是的", uid: "1", name: "看看"}];//有很多项的数据,怎么筛选原数组的数据,新数组只返回text和uid [{text: "大师傅是对方", uid: "1"}, {text: "三顿饭地方发", uid: "1"}, {text: "徐州持续催促", uid: "2"}, {text: "大师傅是对方", uid: "1"}, {text: "大是否都是的", uid: "1"}];
1 回答
浮云间
TA贡献1829条经验 获得超4个赞
let arr =[{op: "danmaku", text: "大师傅是对方", uid: "1", name: "看看"},
{op: "danmaku", text: "三顿饭地方发", uid: "1", name: "流量"},
{op: "danmaku", text: "徐州持续催促", uid: "2", name: "看看"},
{op: "danmaku", text: "大师傅是对方", uid: "1", name: "看看"},
{op: "danmaku", text: "大是否都是的", uid: "1", name: "看看"}];
let _arr = arr.map((ele,index)=>{
return {
text:ele.text,
uid:ele.uid
}
})
console.log(_arr);
添加回答
举报
0/150
提交
取消