.product--production-wrapper.flex-row.col-x4
- for (var i = 0; i < 6; i++)
- var imagePath = ('assets/img/product-image/')
each picture, bedFurniture in ['bed-1.jpg', 'bed-2.jpg', 'bed-3.jpg', 'bed-4.jpg', 'bed-5.jpg', 'bed-6.jpg']
article.bed.card
.product--image
a(href="#"): img(src= imagePath + picture)
.product--desc-wrapper.flex-row
.product--name-href
h5 Product Name
a(href="#") Bed
a(href="#").price $3999
我为文章标记了一个循环,每个函数为其中的图像标记,但我无法弄清楚如何在此代码中为产品名称和价格添加每项功能。如果有人帮忙,我将不胜感激。
答案 0 :(得分:0)
.product--production-wrapper.flex-row.col-x4
- for (var i = 0; i < 6; i++)
- var imagePath = ('assets/img/product-image/')
each item in [ {image: 'bed-1.jpg', price: '1999', name: 'product name 1'}, {image: 'bed-2.jpg', price: '345', name: 'product name 2'}, {image: 'bed-3.jpg', price: '2329', name: 'product name 3'} ]
article.bed.card
.product--image
a(href="#"): img(src=imagePath + item.image)
.product--desc-wrapper.flex-row
.product--name-href
h5= item.name
a(href="#") Bed
a(href="#").price= item.price