简体   繁体   English

玉的多重属性

[英]Multiple attributes in jade

I'm novice in Jade and I have an issue with adding attributes that depend on json data.我是 Jade 的新手,我在添加依赖于 json 数据的属性时遇到问题。 Please see the code below:请看下面的代码:

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

Now, it works fine for me, but I have a notification on the console like this:现在,它对我来说很好用,但我在控制台上有这样的通知:

C:\\mobileGit\\mobile_frontend\\www\\markup\\modules\\product_new\\product_new.jade, line 11: You should not have jade tags with multiple attributes. C:\\mobileGit\\mobile_frontend\\www\\markup\\modules\\product_new\\product_new.jade,第 11 行:您不应该有具有多个属性的 jade 标签。

Maybe someone knows how to fix this trouble.也许有人知道如何解决这个问题。

Tested with : http://jade-lang.com/demo/测试: 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 Output : 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