官网https://ant.design/components/carousel-cn/
1.首先安装antd
yarn add antd
2.index.js导入antd
import 'antd/dist/antd.css'
3.在要使用的页面导入想要的ui组件
import {Carousel} from 'antd'
4.使用
<Carousel autoplay>
<div>
<h3>1</h3>
</div>
<div>
<h3>2</h3>
</div>
<div>
<h3>3</h3>
</div>
<div>
<h3>4</h3>
</div>
</Carousel>,
样式
.ant-carousel .slick-slide {
text-align: center;
height: 160px;
line-height: 160px;
background: #364d79;
overflow: hidden;
}
.ant-carousel .slick-slide h3 {
color: #fff;
}