美文网首页
react swiper bug 偶尔不展示

react swiper bug 偶尔不展示

作者: 曾经也是个少年 | 来源:发表于2020-11-25 20:22 被阅读0次

这个是数组为0是,初始化的swiper 对后续的swiper有影响了,加个 长度不等于零的判断

{
            props.model.length>0 ? <Swiper
                className='test-h'
                indicatorColor='#5F7C99'
                indicatorActiveColor='#297AF8'
                vertical={false}
                circular
                style={{ height: `${props.height}px` }}
                indicatorDots
                autoplay>
                {
                    props.model.map((item, index) => {
                        return <SwiperItem key={index}>
                            <Image src={item} className="img"></Image>
                        </SwiperItem>
                    })
                }

            </Swiper> : null
        }

相关文章

网友评论

      本文标题:react swiper bug 偶尔不展示

      本文链接:https://www.haomeiwen.com/subject/mefoiktx.html