发表于: 2019-03-27 22:56:03

1 690


今天完成的事情:  今天的话主要是用了下第三方的轮播插件SWIPER,以此来实现效果

明天计划的事情:明天的计划是完善这个页面
遇到的问题:主要遇到的问题就是关于这个轮播插件的问题。因为SWIPER这个插件现在已经更新到4了,而且如果要在VUE中使用则还有占们的引入方法,最后实现的效果如下

<b-container>
<div class="wrapper">
 <swiper :options="swiperOption">
   <swiper-slide v-for='item of swiperList' :key="item.id">
     <img :src="item.imgUrl" class="swiper-img">
   </swiper-slide>
   <div class="swiper-button-prev" slot="button-prev"></div><!--左箭头-->
   <div class="swiper-button-next" slot="button-next"></div><!--右箭头-->
 </swiper>

</div>

</b-container>

export default {
 name: 'HomeSwiper',
 data: function () {
   return {
     swiperOption: {
       slidesPerView: 3,
       spaceBetween: 30,
       slidesPerGroup: 1,
       loop: true,
       loopFillGroupWithBlank: true,
       pagination: {
         el: '.swiper-pagination',
         clickable: true
       },
       navigation: {
         nextEl: '.swiper-button-next',
         prevEl: '.swiper-button-prev'
       }
     },

     swiperList:[{
       id:"0001",
       imgUrl:require('../assets/img/home/home-flow-path1.png')
     },{
       id:"0002",
       imgUrl:require('../assets/img/home/home-flow-path2.png')
     },{
       id:'0003',
       imgUrl:require('../assets/img/home/home-flow-path3.png')
     },{
       id:'0004',
       imgUrl:require('../assets/img/home/home-flow-path4.png')
     }
     ],
   }
 }
}

图片的路径是随机选的,等到后端给出图片路径基本就没啥问题了

收获:  对于这个插件的工作流程算是基本上有了很深的了解。包括在页面之中怎么引入等等的问题。以及怎样去渲染这个轮播图中的内容


返回列表 返回列表
评论

    分享到