Ant Design Vue多张图为一组轮播展示

目的

实现多张图为一组轮播展示效果Ant Design Vue多张图为一组轮播展示_第1张图片

H5代码块

<div class="rightDisplay">
  <a-carousel arrows autoplay>
    <div slot="prevArrow" slot-scope="props" class="custom-slick-arrow" style="left: -24px;zIndex: 1">
      <a-icon type="left-circle" />
    </div>
    <div slot="nextArrow" slot-scope="props" class="custom-slick-arrow" style="right: -24px">
      <a-icon type="right-circle" />
    </div>
    <div v-for="(obj,key) in rightDisplay" :key="key">
      <div v-for="(obj2,key) in obj.imgs" :key="key" class="hotBox">
        <img :src="obj2.src"/>
        <h3>{{obj2.title}}</h3>
      </div>
    </div>
  </a-carousel>
</div>

CSS代码块

.rightDisplay .ant-carousel .slick-slide {
  height: 250px;
  overflow: hidden;
  background: #fff;
}
.rightDisplay .ant-carousel .slick-slide .hotBox{
  width: 30%;
  float: left;
  margin-left: 2.5%
}
.rightDisplay .ant-carousel .slick-slide .hotBox img{
  height:200px;
}
.rightDisplay .ant-carousel .custom-slick-arrow {
  width: 25px;
  height: 25px;
  font-size: 25px;
  color: #fff;
  background-color: rgba(31, 61, 35, 0.11);
  opacity: 0.5;
}
.rightDisplay .ant-carousel .custom-slick-arrow:before {
  display: none;
}
.rightDisplay .ant-carousel .custom-slick-arrow:hover {
  opacity: 0.7;
}

数据

rightDisplay:[{
  imgs:[{
    src:"https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1672984128,966606357&fm=26&gp=0.jpg",
    title:"版权名称",
    },{
      src:"https://www.baidu.com/img/bd_logo1.png",
      title:"版权名称2",
    },{
      src:"http://img2.imgtn.bdimg.com/it/u=3580499685,2387378571&fm=26&gp=0.jpg",
      title:"版权名称3",
  }],
  },{
    imgs:[{
      src:"https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1672984128,966606357&fm=26&gp=0.jpg",
      title:"版权名称4",
      },{
        src:"https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1672984128,966606357&fm=26&gp=0.jpg",
        title:"版权名称5",
      },{
        src:"http://img2.imgtn.bdimg.com/it/u=3580499685,2387378571&fm=26&gp=0.jpg",
        title:"版权名称6",
    }],
}],

你可能感兴趣的:(Ant,Design,Vue)