你好!
我有一个mixin,在某些地方,在链接中,我需要将它添加到id中,我如何通过变量和条件来完成?
mixin product-slider-item(title, image, text, new1, finger)
+e.item(class!=attributes.class)
+e('a').link(href='javascript:void(0);' title='#{title}' class!=attributes.class)
if new1 == true
+all-icons('--catalog-novinka --catalog', '--catalog', true)
if finger == true
+all-icons('--sticker --catalog-sticker', '--catalog', true)
+e.image-wrap(class!=attributes.class)
+e('img').image(src="#{image}" alt="" class!=attributes.class)
+e.info(class!=attributes.class)
+e.title #{title}
+e.text
span #{text}
+e.more-link(class!=attributes.class)
span ПОДРОБНЕЕ
必须
在第一种情况下 获得输出
<a href="javascript:void(0);" title="U5011" **data-id="1"** class="b-product-slider__link b-product-slider__link--catalog"></a>
在第二种情况下
<a href="javascript:void(0);" title="U5011" class="b-product-slider__link b-product-slider__link--catalog"></a>
您也可以使用这样
&attributes的对象attributes结果将是