我目前有两个可观察对象,我想合并到一个数组中以发送到后端应用程序进行处理,它们是:
self.ElementData = ko.observable(localStorage.getItem('ElementDataWidget'));
self.scorecardIDLocalStorage = ko.observable(localStorage.getItem('scorecardId'));
我的问题是后端仅接受一个参数,而不接受两个参数。我如何合并这两个?我已经从这段代码开始,但是我对此感到困惑。
self.ElementData = ko.observable(localStorage.getItem('ElementDataWidget'));
self.scorecardIDLocalStorage = ko.observable(localStorage.getItem('scorecardId'));
self.LocalstorageData = ko.computed(function(){
var tempStorage = [];
ko.Utils.arrayForEach(self.ElementData(), function(item){
tempStorage.push({
})
})
})
self.LocalstorageData = ko.computed(function(){
var tempStorage = [];
ko.Utils.arrayForEach(self.ElementData(), function(item){
tempStorage.push({
})
})
return tempStorage // <--- !!
}, this) // <--- !!