vue3中swiper纵向上下叠加轮播图

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<!--纵向轮播-->
<template>
  <div class="swiper-box">
    <swiper
        :direction="'vertical'"
        :slidesPerView="3.9"
        :mousewheel="true"
        :modules="modules"
        :centeredSlides="true"
        :watchSlidesProgress="true"
        :loop="true"
        @slideChange="onSlideChange"
        class="vertical-swiper"
    >
      <swiper-slide v-for="(item, index) in state.q4List"
                    class="list-view"
                    :key="item.id"
                    :class="{'active': index == 1}"
      >
        <div class="item-view">
          <img src="https://img1.baidu.com/it/u=2828363083,1105406468&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500" alt="志愿深圳">
          <div class="info">
            <label>李雪琴</label>
            <p>{{item.describe}}</p>
            <div class="time">
              <small>2022-03-19 16:27:10</small>
              <span>
                    <i class="iconfont icon-a-dianzan2"></i>
                    8740
                  </span>
            </div>
          </div>
        </div>
      </swiper-slide>
 
    </swiper>
  </div>
</template>
 
<script lang="ts" setup>
import {Swiper, SwiperSlide} from "swiper/vue";
import { EffectCoverflow, Mousewheel} from "swiper";
 
import "swiper/css/effect-coverflow";
import WOW from "*.js";
const modules = [EffectCoverflow, Mousewheel]
 
const state:any = reactive({
  q4List: [
    {
      id: 1,
      describe: '两小时深圳青年突击队紧急集结'
    },{
      id: 2,
      describe: '深圳3.7万名青年突击队员奋战抗疫一线'
    },{
      id: 3,
      describe: '深圳青年志愿服务队支援抗疫'
    },{
      id: 4,
      describe: '抗疫一线,青年担当'
    }
  ],
})
 
// 轮播图切换
const onSlideChange = (e: any) => {
  let { slides } = e
  for (let i = 0; i < slides.length; i++) {
    let slide = slides.eq(i)
    let progress = slides[i].progress
    slide.css({
      'opacity': '',
      'background': ''
    });
    slide.transform('');//清除样式
    slide.transform('scale(' + (1 - Math.abs(progress) / 8) + ')');
  }
};
 
</script>
 
<style lang="scss" scoped>
.swiper-box{
  margin-top: 30vh;
  width: 800px;
}
.vertical-swiper{
  height: 600px;
  ::v-deep(.swiper-slide-active){
    z-index: 999;
    .item-view{
      border: 1px solid #E60012;
      box-shadow: 0px 0px 20px 20px rgba(230, 0, 18, 0.03);
      &:before{
        background: transparent;
      }
    }
  }
}
.list-view{
  .item-view{
    height: 120px;
    background: #FFFFFF;
    border-radius: 30px;
    display: flex;
    padding: 30px;
    position: relative;
    overflow: hidden;
    &:before{
      position: absolute;
      content: '';
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(255, 255, 255, 0.5);
    }
 
    img{
      width: 100px;
      flex: 0 0 100px;
      height: 100px;
      overflow: hidden;
      border-radius: 50%;
      margin-right: 23px;
    }
    label{
      font-size: 24px;
      font-weight: 400;
      color: #727272;
      line-height: 24px;
    }
    .info{
      flex: 1;
    }
    p{
      width: 95%;
      font-size: 34px;
      font-weight: 500;
      color: #1D1F24;
      line-height: 34px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      margin: 15px 0 25px;
    }
    .time{
      font-size: 20px;
      font-weight: 300;
      color: #999999;
      line-height: 20px;
      span{
        float: right;
        margin-right: 35px;
        color:#E60012;
        i{
          vertical-align: top;
        }
      }
    }
  }
}
</style>

  

 

posted @   惠鹏曦  阅读(1722)  评论(2编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示