2.0.2 • Published 11 months ago

vue-agile-scrollbar v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

vue-agile-scrollbar

基于vue的自定义滚动条组件,完全基于浏览器的原生滚动,拥有原生滚动体验,又能自定义滚动条样式,简单而强大

Demo

查看demo

Simple usage

通过npm 或者 yarn安装

yarn add vue-agile-scrollbar

npm i vue-agile-scrollbar

引入

import 'vue-agile-scrollbar/dist/style.css'
import vueAgileScrollbar from 'vue-agile-scrollbar'
<template>
  <div style="height:200px;width:500px;border:solid #eee 1px">
    <vueAgileScrollbar>
      <div style="width:10000px; height:100000px"></div>
    </vueAgileScrollbar>
  </div>
</template>

<script>
import vueAgileScrollbar from 'vue-agile-scrollbar'
import 'vue-agile-scrollbar/dist/style.css'

export default {
  components: { vueAgileScrollbar },
  data () {
    return {
      
    }
  }
}
</script>

Api

scroll props

name类型默认值说明
minBarSizeNumber50滚动条最小尺寸,Y轴滚动条的高度或X轴滚动条的宽度不会小于这个值
scrollTopNumber0指定滚动条滚到距离顶部某个位置
scrollLeftNumber0指定滚动条滚到距离左边某个位置
offsetLeftNumber0滚动距离左边的偏移量
offsetRightNumber10滚动距离右边的偏移量
offsetTopNumber0滚动距离顶部的偏移量
offsetBottomNumber10滚动距离底部的偏移量
isAutoUpdateBooleantrueelement改变后,是否自动更新
dragSpeedXNumber1拖拽X滚动条滚动阀值,值越大滚动越快,越小滚动越慢
dragSpeedYNumber1拖拽Y滚动条滚动阀值,值越大滚动越快,越小滚动越慢
displayTypeStringhover滚动条显示类型 show: 一直显示 hover:鼠标移入显示 hide:一直不显示

event

name回调参数说明
scrollfunction(scrollValue: Object, $event)滚动会触发该事件
scroll-hitfunction(type: String, scrollValue: Object)滚动条触底、触顶、触左、触右后出发该事件
updatedfunction(scrollValue: Object)容器更新后会触发该事件

方法

name参数说明
updated()-element改变后,可以通过该方法手动更新滚动容器状态
setScrollLeft(number)-改变滚动条左边滚动距离
setScrollTop(number)-改变滚动条上边滚动距离
2.0.2

11 months ago

2.0.1

11 months ago

2.0.0

11 months ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago