|
5 | 5 | <a class="msg-btn"></a>
|
6 | 6 | </header>
|
7 | 7 | <div class="container">
|
8 |
| - <section class="slider"></section> |
| 8 | + <section class="slider"> |
| 9 | + <swiper :options="swiperOption" ref="mySwiper" class="myswiper"> |
| 10 | + <!-- slides --> |
| 11 | + <swiper-slide v-for="(item,index) in swiperList" :key="index"> |
| 12 | + <img :src="item.imgUrl" alt="" class="swiper-img"> |
| 13 | + </swiper-slide> |
| 14 | + <!-- Optional controls --> |
| 15 | + <div class="swiper-pagination" slot="pagination"></div> |
| 16 | + </swiper> |
| 17 | + </section> |
9 | 18 | <nav class="lesson-list">
|
10 | 19 | <router-link class="lesson-item" :to="{path: '/lesson', query: {lessonName: item.lessonName, id: item.id}}" v-for="(item,index) in lessonNav" :key="index">
|
11 | 20 | <img class="lesson-item-icon" :src="item.imgUrl" alt="">
|
|
20 | 29 | <script>
|
21 | 30 | import tabBox from '@/components/TabBox'
|
22 | 31 | import footBottom from '@/components/Footer'
|
| 32 | +import 'swiper/dist/css/swiper.css' |
| 33 | +import '../../style/swiper.scss' |
| 34 | +import { swiper, swiperSlide } from 'vue-awesome-swiper' |
| 35 | +
|
23 | 36 | export default {
|
24 | 37 | name: 'webHome',
|
25 | 38 | data () {
|
26 | 39 | return {
|
27 |
| - msg: 'init', |
| 40 | + swiperList: [ |
| 41 | + { |
| 42 | + imgUrl: require('../../assets/images/series_1.png') |
| 43 | + }, |
| 44 | + { |
| 45 | + imgUrl: require('../../assets/images/series_2.png') |
| 46 | + }, |
| 47 | + { |
| 48 | + imgUrl: require('../../assets/images/series_1.png') |
| 49 | + } |
| 50 | + ], |
28 | 51 | lessonNav: [
|
29 | 52 | {
|
30 | 53 | lessonName: '语文',
|
@@ -122,12 +145,33 @@ export default {
|
122 | 145 | view: '1265',
|
123 | 146 | price: 53.6
|
124 | 147 | }
|
125 |
| - ] |
| 148 | + ], |
| 149 | + swiperOption: { |
| 150 | + pagination: { |
| 151 | + el: '.swiper-pagination', |
| 152 | + clickable: true, |
| 153 | + bulletClass: 'slide-bullet', |
| 154 | + bulletActiveClass: 'slide-bullet-active' |
| 155 | + }, |
| 156 | + autoplay: true, |
| 157 | + loop: true |
| 158 | + } |
126 | 159 | }
|
127 | 160 | },
|
128 | 161 | components: {
|
129 | 162 | tabBox,
|
130 |
| - footBottom |
| 163 | + footBottom, |
| 164 | + swiper, |
| 165 | + swiperSlide |
| 166 | + }, |
| 167 | + computed: { |
| 168 | + swiper () { |
| 169 | + return this.$refs.mySwiper.swiper |
| 170 | + } |
| 171 | + }, |
| 172 | + mounted () { |
| 173 | + }, |
| 174 | + methods: { |
131 | 175 | }
|
132 | 176 | }
|
133 | 177 | </script>
|
@@ -171,10 +215,6 @@ export default {
|
171 | 215 | background-size: cover;
|
172 | 216 | }
|
173 | 217 | }
|
174 |
| -.slider{ |
175 |
| - height:268px; |
176 |
| - background-color:#d2d2d2; |
177 |
| -} |
178 | 218 | .lesson-list{
|
179 | 219 | padding:8px 10px;
|
180 | 220 | display: flex;
|
|
0 commit comments