繁体   English   中英

玉的多重属性

[英]Multiple attributes in jade

我是 Jade 的新手,我在添加依赖于 json 数据的属性时遇到问题。 请看下面的代码:

- var promoCode = data.promoCode - var instalments = data.instalments div(class= promoCode === true ? "product__img-wrap_promo-code" : "")(class= instalments === true ? "product__img-wrap_instalments" : "")

现在,它对我来说很好用,但我在控制台上有这样的通知:

C:\\mobileGit\\mobile_frontend\\www\\markup\\modules\\product_new\\product_new.jade,第 11 行:您不应该有具有多个属性的 jade 标签。

也许有人知道如何解决这个问题。

测试: http : //jade-lang.com/demo/

- var promoCode = true
- var instalments = true

div(class=promoCode === true ? "product__img-wrap_promo-code" : "", class= instalments === true ? "product__img-wrap_instalments" : "")

HTML 输出:

<div class="product__img-wrap_promo-code product__img-wrap_instalments"></div>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM