uniapp中实现中间大两边小轮播图

组件代码直接引入项目就可以看效果

<template>
  <view class="certificate">
    <view class="title">{{title}}</view>
    <view class="con-part2-con">
        <swiper class="swiper-tall" :autoplay="false" :interval="3000" :duration="1000"
            circular='true' previous-margin='161rpx' next-margin='161rpx' current='0' @change="partSwiperChange">
            <swiper-item class="con-part2-con-container"
          :class="partcurrentIndex === index?'active-item':''"
                v-for="(item,index) in partSwiperChangeList" :key="index">
          <view :class="['info-warp', partcurrentIndex === index?'active':'']">
            <image class="img" :src="item.pic" mode=""></image>
          </view>
          
            </swiper-item>
        </swiper>
    </view>
  </view>
</template>

<script>
  export default {
    props:{
      title:{
        typeof: String,
        default:''
      },
      data:{
        typeof: Array,
        default:()=>[]
      }
    },
    data(){
      return{
        partSwiperChangeList: [
          {
                pic: 'https://picsum.photos/161/119?1',
            },
          {
                pic: 'https://picsum.photos/161/119?2',
            },
            {
                pic: 'https://picsum.photos/161/119?3',
            },
        ],
        partcurrentIndex: 0,
      }
    },
    methods:{
      partSwiperChange(event) {
          this.partcurrentIndex = event.detail.current
      }

    }
  }
</script>

<style scoped lang="scss">
  .certificate{
    margin-bottom: 60rpx;
    padding: 0 15rpx;
    .title{
      margin-bottom: 15rpx;
      width: 108rpx;
      height: 38rpx;
      font-family: PingFangSC, PingFang SC;
      font-weight: 600;
      font-size: 27rpx;
      color: #44B00B;
      line-height: 38rpx;
      text-align: left;
      font-style: normal;
    }
    .con-part2-con {
        width: 646rpx;
        .swiper-tall {
            .con-part2-con-container {
                display: flex;
                align-items: center;
          width: 323rpx !important;
          height: 238rpx;
          overflow: visible;
                .info-warp {
            display: block;
                    width: 323rpx;
                    height: 238rpx;
            // background-color: #000;
            .img{
              width: 100%;
              height: 100%;
              display: block;
            }
                }
                .active {
            position: relative;
            bottom: 36rpx;
                    transform: scale(1.3);
                    transition: all 0.2s ease-in 0s;
            // background-color: red;
                }
            }
        .active-item{
          z-index: 999;//使中间的元素放在上面
        }
        }
    }
  }
</style>

相关推荐

  1. uniapp实现两边

    2024-04-12 01:08:02       39 阅读
  2. 程序实现左向堆叠

    2024-04-12 01:08:02       49 阅读
  3. 微信程序实现

    2024-04-12 01:08:02       38 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-12 01:08:02       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-12 01:08:02       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-12 01:08:02       87 阅读
  4. Python语言-面向对象

    2024-04-12 01:08:02       96 阅读

热门阅读

  1. SpringBoot中的yaml 与properties文件书写格式

    2024-04-12 01:08:02       37 阅读
  2. Python数据分析可视化之NumPy的使用

    2024-04-12 01:08:02       35 阅读
  3. Leaflet.js常用API记录

    2024-04-12 01:08:02       36 阅读
  4. 【运行环境】加载资源的形式

    2024-04-12 01:08:02       42 阅读
  5. Hutool是什么依赖?

    2024-04-12 01:08:02       39 阅读
  6. debian内核版本升级步骤详解

    2024-04-12 01:08:02       36 阅读
  7. jmeter生成随机数的详细步骤及使用方式

    2024-04-12 01:08:02       33 阅读
  8. 深入探讨string类的奥秘

    2024-04-12 01:08:02       38 阅读
  9. LISP入门

    2024-04-12 01:08:02       38 阅读