webview渲染模式下,动态的设置swiper-item的style会导致样式错乱,但是未找到任何官方说明不能设置动态样式,以上代码片段模拟了我遇到的问题,通过 如下方式
let index = 0;
let colors = ['#f09','#80f','#603'];
let timer = setInterval(()=>{
this.setData({
[`background[${index}].d`]:colors[index],
index: index+1
});
index++;
if(index >= this.data.background.length) {
clearInterval(timer);
}
},2000);
每隔两秒设置一次swiper-item上定义的 样式-background-color 将导致 swiper-item样式错乱。
