vue-scrollbars
自己有这个需求,但是没有找到特别适合的,所以直接写了一个
基于 Vue 的 PC 端滚动组件 简单 轻量 高效
仅对原生滚动组件进行滚动条样式统一化处理,并添加自动隐藏,拖动滚动等常用功能
github
if you like , click star , thanks!
DEMO
使用示例请看 app.vue
How to use
sudo npm i @zhangzhengyi12/vue-scrollbars --svae
global regisiter
import Vue from 'vue'
import Scrollerbars from '@zhangzhengyi12/vue-scrollbars'
Vue.use(Scrollerbars)
OR in component
import Scrollerbars from '@zhangzhengyi12/vue-scrollbars'
// in vue component
export default {
components: { Scrollerbars }
}
<scrollbars style="height:200px" autoHide>
<!-- you content -->
</scrollerbars>
Props
name | type | desc | default |
---|---|---|---|
autoHide | Boolean | auto hide scrollbar | false |
hideTime | Boolean | auto Hide Time | 1000 |
data | Array | on watch Data Change refresh Bar | |
displayBar | Boolen | display scrollbar | true |
listenScrollBottom | Function | Called when scrolling to the bottom | false |
scrollBottomHeight | Number | listenScrollBottom handler Trigger height | empty func |
APIS
name | params | desc |
---|---|---|
refresh() | null | refersh scrollbar |
this.$refs.scrollbars.refresh()
Event
name | params | desc |
---|---|---|
@scroll | scroll event object | native scroll Event |