我更改了places函数,以便在调用调用者之前发生错误。
这个角色能说什么?也许在一公里范围内的某个地方没有关闭?
UPD:例如,如果我将第一个字符串放在末尾,它的代码可以正常工作:
SCRIPT5022:传递一个函数,该函数返回dependentObservable knockout-2.0.0.debug.js 的值,第 1054 行字符 9
osagoViewModel.fields.yearsBoxes = new field("Years", yearsBoxesFunc, null, osagoViewModel);
function yearsBox() {
this.year = new field("Years", function () { return ["1 year", "2 years", "3 years", "4 years", "5 years", "6 years", "7 years", "8 years", "9 years", "10 years"]; }, null, osagoViewModel);
}
var yearsBoxesFunc = function () {
var yearsBoxCount = osagoViewModel.fields.driversCount.selectedValue();
var retArrFunc = function (count) {
var arr = [];
for (var i = 0; i < count; i++) {
arr.push(new yearsBox());
}
return arr;
};
switch (yearsBoxCount) {
case "many":
return retArrFunc(0);
case "1":
return retArrFunc(1);
case "2":
return retArrFunc(2);
case "3":
return retArrFunc(3);
case "4":
return retArrFunc(4);
case "5":
return retArrFunc(5);
}
}