我想在 knockout.js 中模仿一个复杂的模型:
function DefInfo(dfirst, dlast) {
this.dfirst = ko.observable(dfirst);
this.dlast = ko.observable(dlast);
}
function PaymentViewModel() {
var self = this;
self.pmt = ?? (where pmt.defInfo = DefInfo, pmt.contact = ContactInfo, etc
}
基本上我要做的是使用 ko.toJson(pmt); 传回 json;
这可能吗?
谢谢