我的视图模型中有一个工具栏对象,它确实被渲染了:
var toolbar = {
items: [
{
location: 'before',
template: 'nav-button'
},
{
location: "before",
html: ko.observable(showCurrentDateTime()),
tabIndex: 1
},
{
location: "center",
text: "title",
},
{
location: "after",
html: "<img src='../images/logo.png'>"
}
]
};
但是,当我尝试将其中一个对象项的内容设置如下时,VS2013 给了我一个奇怪的错误:
toolbar.items[1].html(showCurrentDateTime());
error: The property 'html' does not exist on value of type '{}'
我应该如何正确声明/初始化工具栏?
提前致谢