GithubHelp home page GithubHelp logo

vue-slider's Introduction

vue-slider

Vue 的图片轮播组件 (a vue slider component),可以直接使用,支持配置

本项目是 使用 React 实现一个轮播组件 的 Vue 版本。

使用方法

  • 用 npm 安装本组件
npm i vue-slider
  • 在项目中引用配置示例
<template lang="jade">
  div
    slider(:items="items", :speed="2", :delay="3", :pause="true", :autoplay:"true", :dots="true", :arrows:"true")
</template>
<script>
  import Slider from '../slider/Slider'
  export default {
    data () {
      return {
        items: [
          {
            src: 'http://placehold.it/350x150/999999/000000',
            alt: 'images-1'
          },
          {
            src: 'http://placehold.it/350x150/eeeeee/c90023',
            alt: 'images-2'
          },
          {
            src: 'http://placehold.it/350x150/333333/eeeeee',
            alt: 'images-3'
          }
        ]
      }
    }, //图片数组,有几张图片放几张
    components: {
      Slider
    }
  }
</script>

组件参数

以下参数除了 items 必须传入,其他都有默认值,可以查看 slider/Slider.vue 文件中的 props 设置

参数 是否必须 参数值 默认值
items 图片数组
speed 轮播切换图片的速度 1.5
delay 自动轮播时候停留的时间 2
pause 鼠标放上图片是否停止自动轮播 true
autoplay 是否自动轮播 true
dots 是否需要下面的轮播点点位 true
arrows 是否需要左右点击箭头 true

example 中的示例

安利一个快速配置 webpack 的工具:🔨tooling

// 安装 webpack 工具 tooling
npm i -g tooling

// 安装本组件依赖
npm i -d

// 查看例子
npm run watch:example

// 打包例子
npm run build:example

// 打包 slider 组件
npm run build

在浏览器打开 http://localhost:3003/。

打包的示例文件在 builid 下面。

打包的 slider 组件 jsdist 下面。

vue-slider's People

Contributors

abisuq avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.