uniapp实现轮播swiper中间大两头小

简介: uniapp实现轮播swiper中间大两头小

html

<swiper class="swiper-block" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000" circular='true' previous-margin='90rpx' next-margin='90rpx' current='0' @change="swiperChange">
        <swiper-item class="swiper-item" v-for="(item,index) in swiperImgUrls">
          <image :src="item" :class="['slide-image', currentIndex === index?'active':'']" mode="aspectFill"></image>
        </swiper-item>
</swiper>

js

  data() {
      return {
        swiperdata:[],
        swiperImgUrls: [
              'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2797486824,1669366989&fm=26&gp=0.jpg',
              'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606209804674&di=43e85524ef76a0511e2a6003ae1cd56a&imgtype=0&src=http%3A%2F%2Fa2.att.hudong.com%2F41%2F37%2F01300000169980121904374291568.jpg',
              'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1606209804674&di=01613472182e0cd4ac6eaaaf9ba18eea&imgtype=0&src=http%3A%2F%2Ffile02.16sucai.com%2Fd%2Ffile%2F2014%2F0829%2F372edfeb74c3119b666237bd4af92be5.jpg'
            ],
        currentIndex:0
      }
    },
  method:{
    swiperChange(event) {
        console.log(event)
        this.currentIndex = event.detail.current
      }
  }

css

    .swiper-block {
      height: 300rpx;
      width: 100%;
      }
      .swiper-item {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: flex-start;
      overflow: unset;
      }
      .slide-image {
      height: 250rpx;
      width: 520rpx;
      border-radius: 9rpx;
      box-shadow: 0px 0px 30rpx rgba(0, 0, 0, 0.2);
      margin: 0rpx 30rpx;
      z-index: 1;
      }
      .active {
      transform: scale(1.14);
      transition: all 0.2s ease-in 0s;
      z-index: 20;
      }
相关文章
|
5月前
|
小程序 JavaScript
【微信小程序】之轮播图、swiper、swiper-item、banner组件使用
【微信小程序】之轮播图、swiper、swiper-item、banner组件使用
【微信小程序】之轮播图、swiper、swiper-item、banner组件使用
|
5月前
|
JavaScript
uniapp写轮播图?
uniapp写轮播图?
|
12月前
|
前端开发 JavaScript
uniapp实现轮播swiper中间大两头小
uniapp实现轮播swiper中间大两头小
144 0
|
JavaScript 容器
使用 swiper 做轮播图
使用 swiper 做轮播图
752 0
使用 swiper 做轮播图
|
2月前
|
移动开发 资源调度 JavaScript
Vue2使用触摸滑动插件(Swiper)
这篇文章介绍了在Vue 3框架中如何使用Swiper插件来创建不同类型的触摸滑动组件,包括轮播图、淡入淡出效果和走马灯效果,并提供了详细的配置选项和使用示例。
177 1
Vue2使用触摸滑动插件(Swiper)
|
2月前
|
JavaScript API UED
Vue3使用触摸滑动插件(Swiper)
本文介绍如何在Vue2项目中使用Swiper插件实现触摸滑动功能,并封装了两种轮播图展示形式:首页轮播图(`type: banner`)和走马灯轮播图(`type: carousel`),以及信息展播模式(`type: broadcast`)。支持自定义轮播图片、区域尺寸、动画效果等属性。通过示例代码展示了不同切换动画及自定义效果,并提供了在线预览。适用于多种应用场景,提升用户体验。
Vue3使用触摸滑动插件(Swiper)
|
3月前
|
开发框架 JavaScript 前端开发
循序渐进BootstrapVue,开发公司门户网站(4)--- 使用b-carousel-slide组件实现图片轮播以及vue-awesome-swiper实现图片滑动展示
循序渐进BootstrapVue,开发公司门户网站(4)--- 使用b-carousel-slide组件实现图片轮播以及vue-awesome-swiper实现图片滑动展示
|
5月前
|
移动开发 JavaScript 小程序
uView Swiper 轮播图
uView Swiper 轮播图
144 0
|
5月前
|
前端开发 JavaScript
Vue+Swiper实现轮播图效果
Vue+Swiper实现轮播图效果
134 1