Socket
Socket
Sign inDemoInstall

vue-concise-slider

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-concise-slider

vue-slider,A simple sliding component,has easy configuration,support self-adaption / fullscreen / button / page,and is compatible with mobile and PC terminal


Version published
Weekly downloads
1.5K
decreased by-6.23%
Maintainers
1
Weekly downloads
 
Created
Source

中文 | English

vue-concise-slider.js

npm npm npm


vue-concise-slider,一个简单的滑动组件,配置简单,支持自适应/全屏+按钮+分页,同时兼容移动端和PC端

版本

v2.1.1 ~ v2.1.2 组件发布至NPM v2.1 支持vue2.0+

目前已实现

  • 全屏自适应
  • 移动端兼容
  • 垂直滚动
  • 定时自动切换
  • 不定宽度滚动
  • 无缝循环滚动
  • 多级滚动

未来将实现

  • 渐变滚动
  • 视差效果

例子

slider效果
完整文档

安装

  npm install vue-concise-slider --save

app.vue父级组件

<template>
  <slider :pages="pages" :sliderinit="sliderinit">
    <!-- slot  -->
  </slider>
</template>

<script>
import slider from 'vue-concise-slider'// 引入slider组件
export default {
   el: '#app',
   data () {
      return {
        //图片列表[arr]
        pages:[
          {
            title: '',
            style:{
             background:'url(src/img/testimg-1.jpg)'
            }
          },
          {
           title: '',
           style:{
            background:'url(src/img/testimg-2.jpg)'
            }
          },
          {
            title: 'slide3',
            style:{
              background:'#4bbfc3',
            },
          }
        ],
        //滑动配置[obj]
        sliderinit: {
          currentPage: 0,//当前页码
          thresholdDistance: 500,//滑动判定距离
          thresholdTime: 100,//滑动判定时间
          autoplay:1000,//自动滚动[ms]
          loop:true,//循环滚动
          direction:'vertical',//方向设置,垂直滚动
          infinite:1,//无限滚动前后遍历数
          slidesToScroll:1,//每次滑动项数
        }
      }
    },
    components: {
        slider
    }
}
</script>

pages/初始化参数

OptionTypeDefaultDescription
titlestring-当前设置为每页的标题,未来将直接输出html
styleobj-直接作用在每个item上的style样式,可以输出背景图,背景色,每项宽度可自定义,自动切换为不定宽滚动

sliderinit/初始化参数

OptionTypeDefaultDescription
directionstring'horizontal'方向设置,默认为水平滚动('horizontal'),可设置为垂直滚动('vertical')
currentPagenumber-当前为第几页
thresholdDistancenumber-滑动距离阈值
thresholdTimenumber-滑动时间阈值
autoplaynumber[ms]-自动播放:时间[ms]
loopbooleanfalse循环滚动
infinitenumber1loop无缝滚动时,可以设置前后遍历数
slidesToScrollnumber1每次滑动切换的页数

API/父级传递的事件

MethodParametersDescriptionExample
slideTonumber滑动到(number)页childComponents.$emit('slideTo', num)
slideNext-滑动到下一页childComponents.$emit('slideNext')
slideTo-滑动到上一页childComponents.$emit('slidePre')

API/父级监听的事件

MethodParametersDescriptionExample
slidenumber当前滑动到第(number)页childComponents.$on('slide', function(pagenum){console.log(pagenum)})

有更好的想法?

欢迎来留下你的意见:https://github.com/warpcgd/vue-concise-slider/issues/1

BUG?oh no!

可以在这里提交,会尽快处理:https://github.com/warpcgd/vue-concise-slider/issues/2

FAQs

Package last updated on 03 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc