在我的 js 中,我正在调用一个函数,点击这里是我的函数
function PopulateBranch(branchAreaName) {
var nodePath = "/content/eng/phone-numbers/jcr:content/content-page/wireframe";
$.ajax({
data: "action="+"getBranch"+ "&nodePath=" + nodePath + "&nodeName=" + branchAreaName,
url: '/bin/branchlocator/crud' ,
dataType: 'json',
type: 'GET',
success: function (data) {
self.PopulateBranch = ko.computed(function(){
ko.utils.arrayForEach(data, function(item){
branchView.Branches.push(new Branch(item));
});
});
},
error: function (exception) {
alert("fail");
}
});
};
我在视图模型中调用此函数,但是当我调用此函数时出现此错误
Uncaught Error: Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.
任何解决方案?