博客
关于我
vue_cli轮播图--swiper插件
阅读量:369 次
发布时间:2019-03-05

本文共 1574 字,大约阅读时间需要 5 分钟。

vue_cli轮播图

轮播图–swiper插件

<template>  <div class="app-banner">  <!--swiper的bug,如果数据是从网络获取的, 那么自动轮播到最后一页之后就不轮播了-->  <!--只需要在swiper组件上面加上v-if="数据.length > 0"-->  <!--<swiper :options="swiperOption" class="banner" v-if="banners.length > 0">-->    <swiper :options="swiperOption">      <swiper-slide>        <img class="img" src="../assets/images/banner01.jpg" alt="">      </swiper-slide>      <swiper-slide>        <img class="img" src="../assets/images/banner02.jpg" alt="">      </swiper-slide>      <swiper-slide>        <img class="img" src="../assets/images/banner03.jpg" alt="">      </swiper-slide>      <!-- 分页器 -->      <div class="swiper-pagination" slot="pagination"></div>    </swiper>  </div></template><script>// import 'swiper/swiper-bundle.css'import 'swiper/dist/css/swiper.css'import {    swiper, swiperSlide } from 'vue-awesome-swiper'export default {     name: 'AppBanner',  data () {       return {         swiperOption: {           loop: true, // 循环模式选项        autoplay: {             delay: 1000,          stopOnLastSlide: false, // 当切换到最后一个slide时停止自动切换          disableOnInteraction: false // 用户操作swiper之后,是否禁止aotoplay        },        // 如果需要分页器        pagination: {             el: '.swiper-pagination'        },        observer: true,        observeParents: true,        observeSlideChildren: true      }    }  },  components: {       swiper,    swiperSlide  }}</script><style lang="scss">  .app-banner{       margin-top: 20px;    .img{         width: 100%;      height: 250px;      border-radius: 10px;      box-sizing: border-box;    }  }</style>

结果
在这里插入图片描述

转载地址:http://gxhg.baihongyu.com/

你可能感兴趣的文章
Scala教程之:函数式的Scala
查看>>
java中DelayQueue的使用
查看>>
线程stop和Interrupt
查看>>
Android中定时执行任务的3种实现方法
查看>>
nodejs中npm常用命令
查看>>
mybatis一个怪异的问题: Invalid bound statement not found
查看>>
基于Vue2.0+Vue-router构建一个简单的单页应用
查看>>
基于vue2.0实现仿百度前端分页效果(二)
查看>>
JS魔法堂:函数重载 之 获取变量的数据类型
查看>>
时间序列神器之争:Prophet VS LSTM
查看>>
SpringBoot中关于Mybatis使用的三个问题
查看>>
MapReduce实验
查看>>
Leaflet 带箭头轨迹以及沿轨迹带方向的动态marker
查看>>
java大数据最全课程学习笔记(1)--Hadoop简介和安装及伪分布式
查看>>
java大数据最全课程学习笔记(2)--Hadoop完全分布式运行模式
查看>>
大部分程序员还不知道的 Servelt3 异步请求,原来这么简单?
查看>>
[apue] popen/pclose 疑点解惑
查看>>
[apue] getopt 可能重排参数
查看>>
移动互联网恶意软件命名及分类
查看>>
adb shell am 的用法
查看>>