【发布时间】:2015-04-03 11:48:14
【问题描述】:
我的视图模型中有一个工具栏对象,它确实被渲染了:
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 '{}'
我应该如何正确声明/初始化工具栏?
提前致谢
【问题讨论】:
标签: javascript knockout.js devexpress typescript phonejs