set knockout checkbox标签css-cursor从指针到不允许

时间:2017-11-27 12:16:09

标签: html css knockout.js

SelectAllActiveEnabled为真时,该复选框是可单击的,并且css游标值是指针。当SelectAllActiveEnabled求值为false时,复选框不可单击,但css游标值仍为指针。如何将其设置为不允许?

<label>
    <input type="checkbox" data-bind="checked: selectAllActiveReleases, enable: SelectAllActiveEnabled" />
    @Html.GetTranslation(Center.Infrastructure.TranslationSources.Center_Web_Orders_ReleaseFull_ReleaseOverview_LabelSelectAllActiveReleases)
</label>

1 个答案:

答案 0 :(得分:0)

如果您正在寻找&#34;纯粹淘汰赛&#34;您应该使用style绑定解决方案:

<input type="checkbox" data-bind="checked: selectAllActiveReleases, enable: SelectAllActiveEnabled, style:{'cursor': cursorForCheckbox()}" />

您必须向视图模型中引入cursorForCheckbox。像这样:

self.cursorForCheckbox = ko.pureComputed(function() {return self.SelectAllActiveEnabled() ? 'pointer' : 'not-allowed';});