【发布时间】:2019-02-24 17:03:00
【问题描述】:
我的滑块在三元条件下出现问题,我该如何解决? 它认为我在最后一个子句完成之前关闭了该项目。这是构建多项目轮播的尝试。
<Carousel className="col-md-7 col-11" indicators="true" controls="false">
{this.props.children.map((rooms,index) =>
(index === 0 || index % 3 === 0) ? <Carousel.Item><h1>First</h1> :
((index+1) % 3 === 0) ? <h1>Last</h1></Carousel.Item> : <h1>Middle</h1>
)
}
</Carousel>
【问题讨论】:
-
你有什么问题?请在例如创建一个Minimal, Complete, and Verifiable example CodeSandbox 以便有人更容易帮助您。
标签: reactjs carousel ternary-operator react-bootstrap