李志伟 3 anni fa
parent
commit
d5af995935

+ 3
- 2
src/components/Swiper/index.vue Vedi File

@@ -3,14 +3,15 @@
3 3
     <div class="swiper-wrapper">
4 4
       <slot></slot>
5 5
     </div>
6
+    <slot name="pagination"></slot>
6 7
   </div>
7 8
 </template>
8 9
 
9 10
 <script>
10 11
 import Swiper from 'swiper'
11
-import SwiperCore, { Autoplay } from 'swiper/core'
12
+import SwiperCore, { Autoplay, Pagination } from 'swiper/core'
12 13
 
13
-SwiperCore.use([Autoplay])
14
+SwiperCore.use([Autoplay, Pagination])
14 15
 
15 16
 export default {
16 17
   name: 'Swiper',

+ 33
- 5
src/views/components/ProjectSwiper.vue Vedi File

@@ -1,9 +1,12 @@
1 1
 <template>
2
-  <swiper>
3
-    <swiper-slide v-for="(item, index) in list" :key="item.image" @click.native="$emit('clickItem', index)">
4
-        <pure-image :bg-image="item.image"></pure-image>
5
-    </swiper-slide>
6
-  </swiper>
2
+  <div style="height: 100%">
3
+    <swiper :options="options">
4
+      <swiper-slide v-for="(item, index) in list" :key="item.image" @click.native="$emit('clickItem', index)">
5
+          <pure-image :bg-image="item.image"></pure-image>
6
+      </swiper-slide>
7
+    </swiper>
8
+    <div class="project-swiper-pagination"></div>
9
+  </div>
7 10
 </template>
8 11
 
9 12
 <script>
@@ -14,6 +17,15 @@ export default {
14 17
   },
15 18
   data() {
16 19
     return {
20
+      options: {
21
+        autoplay: {
22
+          delay: 2500,
23
+          disableOnInteraction: false
24
+        },
25
+        pagination: {
26
+          el: '.project-swiper-pagination'
27
+        }
28
+      },
17 29
       list: [
18 30
         {
19 31
           image: require('@/assets/perjectImages/1.png')
@@ -44,3 +56,19 @@ export default {
44 56
   }
45 57
 }
46 58
 </script>
59
+
60
+<style lang="scss">
61
+.project-swiper-pagination {
62
+  width: 100%;
63
+  text-align: center;
64
+
65
+  .swiper-pagination-bullet {
66
+    width: .15rem;
67
+    height: .15rem;
68
+
69
+    & + .swiper-pagination-bullet {
70
+      margin-left: 6px;
71
+    }
72
+  }
73
+}
74
+</style>

+ 2
- 5
src/views/projectIndex.vue Vedi File

@@ -3,12 +3,9 @@
3 3
   <div class="project-index">
4 4
     <img src="@/assets/perjectImages/langbgm.jpg" width="100%" class="bgiclass" @load="handleImageLoad"/>
5 5
     <div class="index-project-swiper" :style="swiperStyle" ref="swiperRef">
6
-      <div class="index-pos-hander" >
7
-        <img :src="require('@/assets/perjectImages/swiperButton.png')" alt="">
8
-      </div>
9 6
       <project-swiper v-if="swiperShow" @clickItem="handleShow"></project-swiper>
10 7
     </div>
11
-    <img src="@/assets/perjectImages/indexbottom.jpg" width="100%" class="bgiclass" @load="handleImageLoad"/>
8
+    <img src="@/assets/perjectImages/indexbottom.jpg" width="100%" class="bgiclass" style="margin-top: 15px" @load="handleImageLoad"/>
12 9
     <div v-for="(item, index) in list" :key="item.image">
13 10
       <yz-modal :visible="visible[index]" class="project-modal" @touchmove.native="handleMove">
14 11
         <div class="modal-inner">
@@ -109,7 +106,7 @@ export default {
109 106
 <style lang="scss" scoped>
110 107
 .project-index {
111 108
   overflow-x: hidden;
112
-  background: #f0f0f0;
109
+  background: #ededed;
113 110
   position: relative;
114 111
 
115 112
   .index-pos-hander {