ReactSwipe 生成页面重复数据。只要2个值的数组。生成了4段html
来源:10-2 获取商户信息
EricPan
2018-04-22
// 数据
this.state = {
carousel:[
'https://p1.meituan.net/deal/87ca42efc65381b306d04a93f580a3e418146.jpg%40450w_280h_1e_1c_1l%7Cwatermark%3D1%26%26r%3D1%26p%3D9%26x%3D2%26y%3D2%26relative%3D1%26o%3D20',
'https://p0.meituan.net/deal/760bc62f2df176b4966a72dfdba399f721121.jpg%40450w_280h_1e_1c_1l%7Cwatermark%3D1%26%26r%3D1%26p%3D9%26x%3D2%26y%3D2%26relative%3D1%26o%3D20',
]
}
// 页面逻辑
<ReactSwipe swipeOptions={opt}>
{this.state.carousel.map((item, key) => (
<div className="figure" key={key}>
<img src={item} />
</div>
))}
</ReactSwipe>// 代码效果

写回答
1回答
-
双越
2018-04-22
遇到这种问题,我建议你制作一个单独的 ReactSwipe 的 demo 来试一下,脱离开复杂的项目环境,看是否也这样的问题
012018-04-23
相似问题