将数组对象转换为对象数组的最佳方法是什么,反之亦然
{
category : ['a','b','c'],
title : ['e','f','g'],
code : ['z','x','v']
}
Run Code Online (Sandbox Code Playgroud)
到
[
{
category : 'a',
title : 'e',
code : 'z'
},
{
category : 'b',
title : 'f',
code : 'x'
},
{
category : 'c',
title : 'g',
code : 'v'
},
]
Run Code Online (Sandbox Code Playgroud) 这里的代码使用动作加载数据,并且会是系列的,但是编辑这段代码很难添加另一个API加载,语法也不清楚.
this.props.loadNutMatrixes({perPage:'all'}).then(()=>{
this.props.loadIngredients().then(()=>{
this.props.getBadge().then(()=>{
this.props.loadNutInfoItems({perPage:'all'}).then(()=>{
this.props.getItemSize().then(()=>{
this.props.getSingleMenuCategory(this.props.category_uid).then(()=>{
this.props.loadAllStores(({per_page:'all'})).then(()=>{
if (this.props.selectedMenuItem ){
initialize("addNewMenuItem", {
...this.props.selectedMenuItem
})
}
})
})
})
})
})
})
})Run Code Online (Sandbox Code Playgroud)