const initialState = {
booksData: [
{"Code":"BK01","price":"5"},
{"code":"BK02","price":"30"},
]
author: [
{"Code":"BK01","name":"Ravi"},
{"code":"BK02","name":"Suresh"},
]
};
combinedBooksData:[
{"Code":"BK01","price":"10","name":"Ravi"},
{"code":"BK02","price":"25","name":"Suresh"},
]
答案 0 :(得分:0)
这应该可以解决问题
var mergedList = _.map(initialState.booksData, function(item){
return _.extend(item, _.findIndex(initialState.author, { id: item.Code }));
});