js 如何转换指定格式?
[ {
allCustomerNum: "-"
hasOrderCustomerNum: "-"
notHasOrderCustomerNum: "-"
}
{
allCustomerNum: "-"
hasOrderCustomerNum: "-"
notHasOrderCustomerNum: "-"
}
{
allCustomerNum: "-"
hasOrderCustomerNum: "-"
notHasOrderCustomerNum: "-"
}
{
allCustomerNum: "-"
hasOrderCustomerNum: "-"
notHasOrderCustomerNum: "-"
}
{
allCustomerNum: "-"
hasOrderCustomerNum: "-"
notHasOrderCustomerNum: "-"
}
{
allCustomerNum: "-"
hasOrderCustomerNum: "-"
notHasOrderCustomerNum: "-"
}
]
如何转成下面这种格式
[['-', '-', '-'],['-', '-', '-']['-', '-', '-'],['-', '-', '-']['-', '-', '-']['-', '-', '-']['-', '-', '-']]
回答:
直接让后端处理
回答:
data.map((item) =>{ const arr = [];
Object.keys(item).forEach((item1) => arr.push('-'));
return arr;
})
回答:
const result =data.map(item => Object.values(item))
回答:
arr.map(item => Object.values(item))
回答:
arr.map(Object.values)
以上是 js 如何转换指定格式? 的全部内容, 来源链接: utcz.com/p/933261.html