• swiper 轮播图圆角滑动变会变成直角然后再回到圆角(iOS)


    ios中,用 swiper 实现轮播图 swiper圆角,图片滑动的时候会先变成直角然后变成圆角(vant)

     

    解决方法:

    在swiper的父盒子上加overflow:hidden 和 transform: translateY(0);

       <div class="my-swipe-box">
          <van-swipe class="my-swipe" @change="swipeChange" :autoplay="3000" indicator-color="white">
            <van-swipe-item v-for="(item,index) in bannerList" :key="index">
              <a :href="item.link_url">
                <img :src="item.pic_path" width="100%" height="100%" />
              </a>
            </van-swipe-item>
    
            <!-- 自定义轮播图指示器 -->
            <template #indicator v-if="bannerList.length >= 2">
              <div class="custom-indicator">
                <span :class="swipeIndex == 0?'indicator_activity':''"></span>
                <span :class="swipeIndex == 1?'indicator_activity':''"></span>
                <span :class="swipeIndex == 2?'indicator_activity':''" v-show="bannerList.length >= 3"></span>
              </div>
            </template>
          </van-swipe>
        </div>
     import { Swipe, SwipeItem } from "vant";
    export default {
      components: {
        [Swipe.name]: Swipe,
        [SwipeItem.name]: SwipeItem
      },
      data() {
        return {
          bannerList: [{
            "link_url": "javascript:;",
            "pic_path": "http://s1.ax1x.com/2020/06/15/N9UykQ.jpg",
          }, {
            "link_url": "http://www.baidu.com",
            "pic_path": "http://s1.ax1x.com/2020/06/15/N9UykQ.jpg",
          }, {
            "link_url": "http://www.baidu.com",
            "pic_path": "http://s1.ax1x.com/2020/06/15/N9UykQ.jpg",
          }]
        };
      },
      methods: {
        // 自定义轮播指示器
        swipeChange(index) {
          this.swipeIndex = index;
        },
      }
    }
    .my-swipe-box {
      height: 208px;
      margin-bottom: 9px;
      border-radius: 6px;
      overflow: hidden;
      transform: translateY(0);
    }
    .van-swipe-item a{
      width: 100%;
      height: 208px;
      display: inline-block;
      border-radius: 6px;
      overflow: hidden;
    }
    .custom-indicator {
      position: absolute;
      bottom: 11px;
      display: flex;
      justify-content: center;
      margin: 0 auto;
      left: 45%;
      span {
        display: inline-block;
        width: 5px;
        height: 2px;
        margin: 0 2px;
        background: rgba(0, 0, 0, 0.1);
      }
      .indicator_activity {
        width: 9px !important;
        background: rgba(255, 255, 255, 1) !important;
      }
    }

    参考文章1: https://developers.weixin.qq.com/community/develop/doc/000ac8a67fc5f0333f6741dd756400

    参考文章2: https://developers.weixin.qq.com/community/develop/doc/00026658428810dd8c07c062556400

  • 相关阅读:
    (转)怎样获得与激活Windows 7超级管理员权限
    (转) C代码优化方案
    英语词汇立体记忆 02
    (转)LUA和C之间的函数调用
    通过lua自带例子学习lua 01
    英语词汇立体记忆 01
    反射(类加载内存分析)
    反射(类加载器的作用)
    反射(动态创建对象操作属性)
    反射(分析类初始化)
  • 原文地址:https://www.cnblogs.com/rachelch/p/13130355.html
Copyright © 2020-2023  润新知