1.0.0 • Published 5 years ago

vue-swipers v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

##轮播图 -html

<div class="carousel-containner">
    <ul class="wrap">
      <li
        class="poster-item"
        v-for="(bk,index) in goodsList"
        :key="index"
        :style="cssList[index]"
        v-touch:swipeleft="pre"
        v-touch:swiperight="next"
      >
        <div class="bkImg">
          <img :src="bk.image" />
        </div>
        <div class="bkName">
          <span>《{{bk.goodsName}}》</span>
        </div>
      </li>
    </ul>
    <div class="bkDes">
      <p>{{goodDes}}</p>
    </div>
  </div>

-css

.carousel-containner {
  width: 100%;
  .wrap {
    width: 2.7rem;
    height: 2.46rem;
    left: 50%;
    margin-left: -1.35rem;
    position: relative;
    display: flex;
    align-items: center;
    flex-direction: column;
    .poster-item {
      transform: translateZ(0);
      width: 1.61rem;
      height: 100%;
      font-size: 0.16rem;
      position: absolute;
      left: 0;
      top: 0;
      background: #fff;
      transition: all 0.5s;
      .bkImg {
        width: 100%;
        height: 90%;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
        img {
          width: 100%;
          height: 100%;
          position: relative;
          z-index: 1;
        }
      }
      .bkName {
        width: 100%;
        margin-top: 5%;
        text-align: center;
        overflow: hidden;
        text-align: center;
        span {
          color: #464c56;
          text-align: center;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          display: block;
        }
      }
    }
  }
  .bkDes {
    margin-top: 0.1rem;
    margin-bottom: 0.19rem;
    width: 3.14rem;
    height: 0.41rem;
    left: 50%;
    margin-left: -1.57rem;
    font-size: 0.14rem;
    color: #454c57;
    line-height: 0.21rem;
    position: relative;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
}