所以我有这个问题,数据没有显示在表格中。
我的视图模型:
var my = {};
my.viewModel = {
Person: ko.observableArray([
{ name: "Alireza", family: "Davoodi", city: "Tehran", date: new Date().getTime() },
{ name: "Alireza", family: "Davoodi", city: "Tehran", date: new Date().getTime() },
{ name: "Alireza", family: "Davoodi", city: "Tehran", date: new Date().getTime() },
{ name: "Alireza", family: "Davoodi", city: "Tehran", date: new Date().getTime() },
{ name: "Alireza", family: "Davoodi", city: "Tehran", date: new Date().getTime() },
])
};
ko.applyBindings(my.viewModel);
看法:
<tbody data-bind="foreach: Person" >
<tr>
<td data-bibd="text: name"></td>
<td data-bibd="text: family"></td>
<td data-bibd="text: city"></td>
<td data-bibd="text: date"></td>
</tr>
</tbody>
数据未列于表中;我哪里错了?
我得到的输出是:[object,object]
谢谢!