Vue.js wrapper for simplebar
First, because custom scrollbars can be very frustrating and you want to add simplebar to your Vue project in an easy way, with the bonus of having some useful scroll events and helper methods out of the box.
npm install vue-simplebar
yarn add vue-simplebar
You can import and register the plugin in the entry point of your application like so:
import VueSimplebar from 'vue-simplebar'
import 'vue-simplebar/dist/vue-simplebar.min.css'
Vue.use(VueSimplebar)
Then use it like any other component:
<vue-simplebar>
<p> Your scrollable content goes here </p>
</vue-simplebar>
Install method takes additional parameters:
Name of your global component.
Default: VueSimplebar
Tag which will be render as simplebar container
Default: section
options {Object}
: Options
simplebar options.
Default: {}
<template>
<vue-simplebar>
<p> Your scrollable content goes here. </p>
</vue-simplebar>
</template>
<script>
import { VueSimplebar } from 'vue-simplebar'
export default {
components: { VueSimplebar }
}
</script>
<style src="vue-simplebar/dist/vue-simplebar.min.css"/>
Tag which will be render as simplebar container
Default: section
options {Object}
: Options
simplebar options.
This wrapper comes with some event helpers.
This event fires when scrolling reaches the start of the x-axis.
This event fires when scrolling reaches the end of the x-axis.
<vue-simplebar @scroll-x-reach-start="" @scroll-x-reach-end="">
<p> Your scrollable content goes here. </p>
</vue-simplebar>
This event fires when scrolling reaches the start of the y-axis (useful for a chat like pagination).
This event fires when scrolling reaches the end of the y-axis (useful for infinite scroll).
<vue-simplebar @scroll-y-reach-start="" @scroll-y-reach-end="">
<p> Your scrollable content goes here. </p>
</vue-simplebar>
If you have any reasonable PR you are welcome.