我想在标题标题之前添加一个 if 语句检查用户数。
<div>
<span data-bind="text:Name()"></span>
<span class="userCount">(<span data-bind="text:UserCount()"></span>)</span>
</div>
<script type="text/html" id="list">
//Want to add if statement here to check if the UserCount() is greater than 13
<h3 id="letter" data-bind="text: Letter"></h3>
......
</script>
如何添加 if 语句来检查 usercount()?
视图模型:
var rViewModel = function (data) {
var _self = this;
_self.ContentRole = ko.observable(data.ContentRole);
_self.Name = ko.observable(data.RoleName);
_self.Rank = ko.observable(data.RoleRank);
_self.UserCount = ko.observable(data.UserCount);
_self.Users = ko.observableArray([]);
};