李志伟 3 years ago
parent
commit
d5af995935

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

3
     <div class="swiper-wrapper">
3
     <div class="swiper-wrapper">
4
       <slot></slot>
4
       <slot></slot>
5
     </div>
5
     </div>
6
+    <slot name="pagination"></slot>
6
   </div>
7
   </div>
7
 </template>
8
 </template>
8
 
9
 
9
 <script>
10
 <script>
10
 import Swiper from 'swiper'
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
 export default {
16
 export default {
16
   name: 'Swiper',
17
   name: 'Swiper',

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

1
 <template>
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
 </template>
10
 </template>
8
 
11
 
9
 <script>
12
 <script>
14
   },
17
   },
15
   data() {
18
   data() {
16
     return {
19
     return {
20
+      options: {
21
+        autoplay: {
22
+          delay: 2500,
23
+          disableOnInteraction: false
24
+        },
25
+        pagination: {
26
+          el: '.project-swiper-pagination'
27
+        }
28
+      },
17
       list: [
29
       list: [
18
         {
30
         {
19
           image: require('@/assets/perjectImages/1.png')
31
           image: require('@/assets/perjectImages/1.png')
44
   }
56
   }
45
 }
57
 }
46
 </script>
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 View File

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