我有一个关于我的 2 淘汰赛 foreach 绑定的问题,我想按类别过滤它。
这是场景
var categorySelected = {CategoryId, CategoryName, MeasureName}
var measureperCategoryData = {CategoryId, MeasureId, MeasureName}
<div class="row" data-bind="foreach: categorySelected">
<div class="headline">
<h4 data-bind="text : $data.CategoryName"></h4>
<div class="row" data-bind="foreach : $root.measureperCategoryData">
<label data-bind="text : $data.MeasureName, if : $parent.CategoryId == $data.CategoryId"> </label>
</div>
</div>
</div>