[英]if and else in Aurelia.js
How can I insert in the DOM a css class using aurelia.js? 如何使用aurelia.js在DOM中插入CSS类?
If my <th>
has the class="aut-asc"
or class="aut-asc"
, I would like to add a extra class called: global
如果我的
<th>
具有class="aut-asc"
或class="aut-asc"
,那么我想添加一个额外的类: global
aut-asc is added when it is clicked, fine but the thing is I need the th who has this class has red background. 单击时添加了aut-asc,很好,但问题是我需要拥有此类具有红色背景的人。
now the background it is just in the arrow. 现在背景正好在箭头中。
.aut-desc:before{
content: $fa-var-sort;
background-color: red;
}
if not don't do anything. 如果不做任何事情。
<thead>
<tr>
<th class="aut-asc">
Sort
</th>
</tr>
</thead>
您可以使用字符串插值来切换在变量中添加和删除css类:
<th class="aut-asc ${toggleVariable ? 'global' : ''}">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.