循环添加图片

 

 

var arr = [
    '../../static/img/icon/good.png',
    '../../static/img/icon/thumbs.png',
    '../../static/img/icon/celebrity.png',
]
let colorBrand = ['#5CC780', '#224CCA', '#306997']
res.data.forEach((item, index) => {
    item['icon'] = arr[index % 3];
    this.tabList.push(res.data[index % 3])
    this.width = this.width * this.tabList.length / 2
    item['background'] = colorBrand[index % 3]
})

 

posted @ 2022-10-27 11:45  挽你手  阅读(16)  评论(0编辑  收藏  举报