循环添加图片
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] })