我有一种商品混合物,它有几种其他的霉素吗?其中包含数组,因此我遇到了在调用我的maksin过程中输入数据的问题
这是您需要填充的阵列之一:
+size-list(item.sized).--square.--product-item
mixin product-item(notice, name, price, size, old, oldprice, img, ...items)
+b.product-item
+e.wrapper
+e.compare
+e.add.--compare(href="javascript:void(0);" title="")
include ui-kit/icon.pug
+icon("compare").--product-item
+e.favorites
+e.add.--favorites(href="javascript:void(0);" title="")
include ui-kit/icon.pug
+icon("favorites").--product-item
if notice == 'vip'
include ui-kit/label.pug
+label('vip').--vip
else if notice == 'hit'
include ui-kit/label.pug
+label('хит').--hit
else if notice == 'new'
include ui-kit/label.pug
+label('new').--new
else if notice == 'sale'
include ui-kit/label.pug
+label('%').--sale
+b.button.--product-quck.js-qick-view(href="javascript:void(0);" title=name) быстрый просмотр
+e.image-wrapper
+e.image.js-wrapper-image(src=img, alt=name, title=name)
+e.color
include select-color.pug
+select-color(...items).--product-item
+e.info
+e.name #{name}
+e.size #{size}
+e.hidden-info
+e.size-change
include ui-kit/hr.pug
+hr().--product-item
include ui-kit/size-list.pug
+size-list(item.sized).--square.--product-item
include characteristic-info.pug
+characteristic-info({'items': [{
'title': 'Ш х В х Г',
'definition': '40 x 55 x 20/24 см'
},
{
'title': 'Объем',
'definition': '38/43 л'
},
{
'title': 'Масса',
'definition': '2,5 кг'
}
]}).--product-item
include ui-kit/price.pug
+price(price, old, oldprice, ".-").--product-item

结论本身试图这样做,但在支架上发誓:
+product-item("vip", "American Tourister Sunset Square Spinner 13G*908", "22 100", "Огромный чемодан-спиннер (XL)", "", "oldprice", "images/content/announcement-1.jpg", "", "#f3e222", "transparent", "#926ca7", "#926ca7", "#7fd0af", "#0bb8b2",{ 'items': [{
'size': [{
"textLabel": "XL",
"name": "size-105",
"id": "size-type-120",
"checked": true
}, {
"textLabel": "L",
"name": "size-105",
"id": "size-type-121"
}, {
"textLabel": "M",
"name": "size-105",
"id": "size-type-122"
}, {
"textLabel": "S",
"name": "size-105",
"id": "size-type-123"
}]
]}
})

我还有其他选择吗?我做错了什么?或者它可以以某种方式设计mixin?
答案 0 :(得分:0)
决定如此
mixin product-item(notice, name, price, size, old, oldprice, img, sized, info,...items)
+b.product-item
+e.wrapper
+e.compare
+e.add.--compare(href="javascript:void(0);" title="")
include ui-kit/icon.pug
+icon("compare").--product-item
+e.favorites
+e.add.--favorites(href="javascript:void(0);" title="")
include ui-kit/icon.pug
+icon("favorites").--product-item
if notice == 'vip'
include ui-kit/label.pug
+label('vip').--vip
else if notice == 'hit'
include ui-kit/label.pug
+label('хит').--hit
else if notice == 'new'
include ui-kit/label.pug
+label('new').--new
else if notice == 'sale'
include ui-kit/label.pug
+label('%').--sale
+b.button.--product-quck.js-qick-view(href="javascript:void(0);" title=name) быстрый просмотр
+e.image-wrapper
+e.image.js-wrapper-image(src=img, alt=name, title=name)
+e.info
+e.info-text
include select-color.pug
+select-color(...items).--product-item
+e.name #{name}
+e.size #{size}
+e.hidden-info
+e.size-change
include ui-kit/hr.pug
+hr().--product-item
include ui-kit/size-list.pug
+size-list(sized).--square.--product-item
include characteristic-info.pug
+characteristic-info(info).--product-item
include ui-kit/price.pug
+price(price, old, oldprice, ".-").--product-item

结论:
+product-item("new", "American Tourister Sunset Square Spinner 13G*908", "22 100", "Огромный чемодан-спиннер (XL)", true, "24 500", "images/content/announcement-1.jpg",
[{
"textLabel": "XL",
"name": "size-100",
"id": "size-type-227",
"checked": true
}, {
"textLabel": "L",
"name": "size-100",
"id": "size-type-228"
}, {
"textLabel": "M",
"name": "size-100",
"id": "size-type-229"
}, {
"textLabel": "S",
"name": "size-100",
"id": "size-type-230"
}],
[{
'title': 'Ш х В х Г',
'definition': '40 x 55 x 20/24 см'
},
{
'title': 'Объем',
'definition': '38/43 л'
},
{
'title': 'Масса',
'definition': '2,5 кг'
}], "", "#f3e222", "transparent", "#926ca7", "#926ca7", "#7fd0af", "#0bb8b2")