vue-scroll-bar
vue-scroll-bar
a simple custom scrollbar vue component, it can support pc and mobile.


Install
npm i vue-scroll-bar --save
Usage
<template>
<scroll-bar class="warp" :scrollTrackStyle="scrollTrackStyle" :scrollBarStyle="scrollBarStyle">
<div class="test">
<p v-for="index in 6">
item no {{index}}
</p>
</div>
</scroll-bar>
</template>
import scrollBar from 'vue-scroll-bar';
export default {
components: { scrollBar },
data() {
return {
scrollTrackStyle: {
backgroundColor: 'red'
},
scrollBarStyle: {
...
}
};
}
};
<style>
.warp{
height: 80px;
overflow: hidden;
}
</style>
Props
| Props | Type | Default | Description |
|---|---|---|---|
| scrollTrackStyle | Object | {} | the style of scroll track |
| scrollTrackYStyle | Object | scrollTrackStyle | the style of scroll track in the direction of Y axis |
| scrollTrackXStyle | Object | scrollTrackStyle | the style of scroll track in the direction of X axis |
| scrollBarStyle | Object | {} | the style of scroll bar |
| scrollBarYStyle | Object | scrollBarStyle | the style of scroll bar in the direction of Y axis |
| scrollBarXStyle | Object | scrollBarStyle | the style of scroll bar in the direction of X axis |
| barYMinHeight | Number | 20 | the min height of scroll bar in the direction of Y axis |
| barXMinWidth | Number | 20 | the min width of scroll bar in the direction of X axis |
| overflow | String | 'auto' | 'auto', 'hidden', 'hidden-x', 'hidden-y' |
| watchValue | Any | null |
when content expands, bar would be refreshed |
| mobile | Boolean | false | scrollbar will be forced to show in mobile mode when it is set to true |
Related Packages
vue-app-scroller
Improved version of the scroll plug-in, support for drop-down refresh and pull u...
575
7
vue-dragscroll
vue directive to make a scrollable element scroll by draging to the scroll direc...
1,541,547
264
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.2.4 | ^2.6.11 | MIT | |
| 1.2.3 | ^2.5.2 | MIT | |
| 1.2.2 | ^2.5.2 | MIT | |
| 1.2.1 | ^2.5.2 | MIT | |
| 1.2.0 | ^2.5.2 | MIT | |
| 1.1.0 | ^2.5.2 | MIT | |
| 1.0.0 | ^2.5.2 | MIT | |
| 0.1.0 | ^2.5.2 | MIT | |
| 0.0.2 | ^2.5.2 | MIT | |
| 0.0.1 | ^2.5.2 | MIT |