vux
vux copied to clipboard
Swiper使用push只会显示最后一条数据。
swiper的list数据如果使用push进行赋值将只会显示最后一条数据,失去原本的功能。需要使用直接赋值。 let temp = []; getCarouselList().then(res => { res.data.contentCarouselList.forEach(element => { temp.push({ url: "javascript:", img: element.picUrl, title: element.contentTitle }); }); this.carouselList = temp; });