代码之家  ›  专栏  ›  技术社区  ›  Kip ei

将淘汰复选框标签css光标从指针设置为不允许

  •  2
  • Kip ei  · 技术社区  · 7 年前

    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 回复  |  直到 7 年前
        1
  •  1
  •   Oleksandr Tyshchenko    7 年前

    如果你在寻找“纯淘汰”解决方案,你应该使用 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';});