vue-swipe轮播图

作者: 月光在心中 | 来源:发表于2017-08-07 21:42 被阅读380次

一、安装饿了么团队开发的vue专用的轮播图插件:vue-swipe
npm install vue-swipe

二、在index.js文件中引用vue-swipe

require('vue-swipe/dist/vue-swipe.css');
import { Swipe, SwipeItem } from 'vue-swipe';

三、在index.js中注册组件

Vue.component('swipe', Swipe);
Vue.component('swipe-item', SwipeItem);

四、在需要使用的components下面的.vue页面中直接引用

  <swipe class="my-swipe">
      <swipe-item class="slide1">1</swipe-item>
      <swipe-item class="slide2">2</swipe-item>
      <swipe-item class="slide3">3</swipe-item>
   </swipe>

需要写样式。样式例子:

.my-swipe {
  height: 200px;
  color: #fff;
  font-size: 30px;
  text-align: center;
}

.slide1 {
  background-color: #0089dc;
  color: #fff;
}

.slide2 {
  background-color: #ffd705;
  color: #000;
}

.slide3 {
  background-color: #ff2d4b;
  color: #fff;
}

vue-swipe的github地址:
https://github.com/ElemeFE/vue-swipe

相关文章

  • vue-swipe轮播图

    一、安装饿了么团队开发的vue专用的轮播图插件:vue-swipenpm install vue-swipe 二、...

  • vue-swipe轮播图的安装使用

    1.安装轮播图依赖 2.在main.js中导入模块,注册全局 3.在需要的vue文件中引用,例子如下: 推荐一个好...

  • 无标题文章

    轮播图分为:传统轮播图、间歇轮播图、呼吸轮播图、无缝滚动轮播图等。它们各具特色,各有用处。 1.传统轮播图 第一步...

  • vue-移动端集成模块

    移动端: vue-swipe:https://github.com/ElemeFE/vue-swipe**幻灯片组...

  • 轮播图

    轮播图分为:传统轮播图、间歇轮播图、呼吸轮播图、无缝滚动轮播图等。 1.传统轮播图 第一步,得到元素 第二步,设置...

  • 现金红包

    每日红包 轮播图 详情图 周末红包 轮播图 详情图 圣诞红包 轮播图 详情图

  • day7_作业

    轮播图1 轮播图2

  • [iOS]定制性强的广告轮播图--SCAdView

    @[无限轮播图] @[3D轮播图] @[广告轮播图] SCAdView Statement If my code ...

  • 普通奖品

    卡西欧小方块 轮播图 详情图 三只松鼠大礼包 轮播图 详情图 天猫精灵 轮播图 详情图 小米蓝牙无线耳机 轮播图 ...

  • 轮播图心得

    轮播图 写轮播图之前我们要认识到几个问题:一、什么是轮播图?二、怎么实现轮播效果?三、轮播图还有什么小功能可以实现...

网友评论

    本文标题:vue-swipe轮播图

    本文链接:https://www.haomeiwen.com/subject/wrqzlxtx.html