Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在淘汰赛绑定方面需要一些帮助。我有以下标签]
<a class="link" data-bind="href: Url">My Url</a>
我想要做的是,如果“Url”为空或为空,则隐藏用户视图中的标签。
我怎样才能做到这一点?
你可以尝试这样的事情:
<a class="link" data-bind="attr: { href: url}, visible: url().length > 0"> My Url </a>
或者如果您根本不希望它出现在标记中:
<!-- ko if: url().length > 0 --> <a class="link" data-bind="attr: { href: url}"> My Url </a> <!-- /ko -->