博客
关于我
vue_cli轮播图--swiper插件
阅读量:380 次
发布时间: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/

你可能感兴趣的文章
MySQL中的字符集陷阱:为何避免使用UTF-8
查看>>
mysql中的数据导入与导出
查看>>
MySQL中的时间函数
查看>>
mysql中的约束
查看>>
MySQL中的表是什么?
查看>>
mysql中穿件函数时候delimiter的用法
查看>>
Mysql中索引的分类、增删改查与存储引擎对应关系
查看>>
Mysql中索引的最左前缀原则图文剖析(全)
查看>>
MySql中给视图添加注释怎么添加_默认不支持_可以这样取巧---MySql工作笔记002
查看>>
Mysql中获取所有表名以及表名带时间字符串使用BetweenAnd筛选区间范围
查看>>
Mysql中视图的使用以及常见运算符的使用示例和优先级
查看>>
Mysql中触发器的使用示例
查看>>
Mysql中设置只允许指定ip能连接访问(可视化工具的方式)
查看>>
mysql中还有窗口函数?这是什么东西?
查看>>
mysql中间件
查看>>
MYSQL中频繁的乱码问题终极解决
查看>>
MySQL为Null会导致5个问题,个个致命!
查看>>
MySQL为什么不建议使用delete删除数据?
查看>>
MySQL主从、环境搭建、主从配制
查看>>
Mysql主从不同步
查看>>