1
我正在嘗試製作一個單選按鈕過濾器,它在選定時更改其背景顏色。現在它看起來是這樣的:knockout.js css-binding語法問題
<div data-bind="visible: applications().length > 0">
<label>Filter: </label>
<label class="radio-inline">
<input type="radio" value="new" data-bind="checked: applicationsFilter, css: {selected: applicationsFilter}" class="" />
New/Pending Review
(<span data-bind="text: newApplicationsCount"></span>)
</label>
<label class="radio-inline">
<input type="radio" value="shortlisted" data-bind="checked: applicationsFilter, css: {selected: applicationsFilter}" />
Shortlisted
(<span data-bind="text: shortlistedApplicationsCount"></span>)
</label>
<label class="radio-inline">
<input type="radio" value="connected" data-bind="checked: applicationsFilter, css: {selected: applicationsFilter}}" />
Connected
(<span data-bind="text: connectedApplicationsCount"></span>)
</label>
<label class="radio-inline">
<input type="radio" value="all" data-bind="checked: applicationsFilter, css: {selected: applicationsFilter}" />
All
(<span data-bind="text: allApplicationsCount"></span>)
</label>
<label class="radio-inline" data-bind="visible: applications().length > 0">
<input type="checkbox" data-bind="checked: showHiddenApplications" />
Include Hidden
</label>
</div>
我的目的是應用.selected類時,通過做
data-bind="checked: applicationsFilter, css: {selected: applicationsFilter}}
選擇的單選按鈕,但產量並不實際應用的CSS樣式。這樣做的正確方法是什麼?
感謝