【问题标题】:Combine class.bind with native class in HTML element in Aurelia将 class.bind 与 Aurelia 中 HTML 元素中的原生类结合起来
【发布时间】:2018-11-30 18:08:09
【问题描述】:

我目前正在尝试通过条件将class.bind 属性与基本html class 组合到html 组件中。喜欢:

<a href="#" class="stackpanel stretch" class.bind="myCondition == true ? 'myClass' :''">

我想得到(如果myCondition = true):

<a href="#" class="stackpanel stretch myClass">

你能告诉我最好的方法是什么吗?

【问题讨论】:

    标签: html css aurelia


    【解决方案1】:

    您无需指定class.bindclass,您可以使用插值语法以及class 属性中的普通类。

    <a href="#" class="stackpanel stretch ${myCondition == true ? 'myClass' : ''}">
    

    【讨论】:

      猜你喜欢
      • 2017-01-22
      • 2017-11-02
      • 2020-11-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-22
      • 1970-01-01
      相关资源
      最近更新 更多