内使用时如不方便绑定都不能正常工作我使用的是淘汰赛JSknockoutjs如果和模板
<tbody data-bind="foreach: List">
<tr>
<td><input type="button" data-bind="if: ($parent.IsFVL || $parent.AllowChat || $root.Me().AllowChatMonitoring), value: ID, click: SelectVisit" /><span data-bind="ifnot: ($parent.IsFVL || $parent.AllowChat || $root.Me().AllowChatMonitoring), text: ID"></span></td>...
下面的模板并调用/启动模板这样
<div data-bind="template: { name: 'tplVisitsGrid', data: { Title: 'My Visits', 'List': MVL, 'AllowChat': true, 'AllowPing': false, 'IsFVL': false } }"></div>
也我已经仔细检查了“$ root.Me()。AllowChatMonitoring”的值是否为true,但输入[type = button]和span都呈现,有人可以帮我解决问题。
谢谢。
这些属性是不可观测的,所以你的建议将无法正常工作。 –
@ArtemVyshniakov对于他们在'If'绑定工作,他们*必须*可观察 – xdumaine