我想要解析“类”HTML属性中的Scala条件,但Scala模板没有发挥作用:
@priceTag(amount: Currency) = @{
<div class='priceTag {if(amount.toDouble == 0.0d) "FREE"}'>
{if(amount.toDouble > 0.0d) {amount.format("¤#")} else {"FREE"}}
</div>
}
产量:
<div class="priceTag {if(amount.toDouble == 0.0d) "FREE"}">
£1
</div>
我希望它产生:
<div class="priceTag">
£1
</div>
建议感激不尽