All Projects → mercs600 → Vue2 Perfect Scrollbar

mercs600 / Vue2 Perfect Scrollbar

Licence: mit
Vue.js wrapper for perfect scrollbar

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue2 Perfect Scrollbar

Vuelayers
Web map Vue components with the power of OpenLayers
Stars: ✭ 532 (+136.44%)
Mutual labels:  vuejs-components, vuejs2
Vue Wordpress Pwa
An offline-first SPA using Vue.js, the WordPress REST API and Progressive Web Apps
Stars: ✭ 665 (+195.56%)
Mutual labels:  vuejs-components, vuejs2
Vue Virtual Scroller
⚡️ Blazing fast scrolling for any amount of data
Stars: ✭ 6,326 (+2711.56%)
Mutual labels:  vuejs-components, vuejs2
vue-notification-bell
Vue.js notification bell component.
Stars: ✭ 64 (-71.56%)
Mutual labels:  vuejs2, vuejs-components
Vue Multi Select
This component gives you a multi/single select with the power of Vuejs components.
Stars: ✭ 92 (-59.11%)
Mutual labels:  vuejs-components, vuejs2
Vue Input Tag
🔖 Vue.js 2.0 Input Tag Component
Stars: ✭ 507 (+125.33%)
Mutual labels:  vuejs-components, vuejs2
Vue Hotel Datepicker
Vue date range picker component
Stars: ✭ 665 (+195.56%)
Mutual labels:  vuejs-components, vuejs2
Vue Swatches
🎨 Help the user picking beautiful colors!
Stars: ✭ 456 (+102.67%)
Mutual labels:  vuejs-components, vuejs2
Nextcloud Vue
🍱 Vue.js components for Nextcloud app development ✌
Stars: ✭ 89 (-60.44%)
Mutual labels:  vuejs-components, vuejs2
Vue Social Sharing
A renderless Vue.js component for sharing links to social networks, compatible with SSR
Stars: ✭ 1,071 (+376%)
Mutual labels:  vuejs-components, vuejs2
Vuex I18n
Localization plugin for vue.js 2.0 using vuex as store
Stars: ✭ 657 (+192%)
Mutual labels:  vuejs-components, vuejs2
Vue Atlas
A Vue.js 2 UI component library.
Stars: ✭ 173 (-23.11%)
Mutual labels:  vuejs-components, vuejs2
V Tag Suggestion
A simple tag component with typeahead
Stars: ✭ 40 (-82.22%)
Mutual labels:  vuejs-components, vuejs2
V2 Table
A simple table component based Vue 2.x: https://dwqs.github.io/v2-table/
Stars: ✭ 96 (-57.33%)
Mutual labels:  vuejs-components, vuejs2
Protovue
A prototyping component library
Stars: ✭ 195 (-13.33%)
Mutual labels:  vuejs-components, vuejs2
Toucan
Boilerplate template using Vue.js, TypeScript and .NET Core 2.1, based on SOLID design principles
Stars: ✭ 215 (-4.44%)
Mutual labels:  vuejs2
Light Blue Vue Admin
🤘Vue admin dashboard template with stylish transparent design
Stars: ✭ 218 (-3.11%)
Mutual labels:  vuejs2
Vue Wp Starter
A WordPress Vue.js starter plugin
Stars: ✭ 214 (-4.89%)
Mutual labels:  vuejs2
Vue Analytics
Google Universal Analytics support in Vue.js
Stars: ✭ 213 (-5.33%)
Mutual labels:  vuejs2
Vuemmerce
👉 Responsive ecommerce template 🛒 built with Vue.js and Nuxt.js
Stars: ✭ 223 (-0.89%)
Mutual labels:  vuejs2

vue2-perfect-scrollbar

Vue.js minimalistic but powerful wrapper for perfect scrollbar

Are you looking compatible version with Vue3 ? check https://github.com/mercs600/vue3-perfect-scrollbar

Why I Created it ?

Because I ❤️ to use perfect-scrollbar in my projects (🙌 utatti). But also because the current solutions on github are outdated or overcomplicated.

Why would you use it ?

Because you want to load perfect-scrollbar to your Vue project in an easy way. But also because this plugin is updated, tested and build by rollup. So you will not find any unnecessary 💩 code in this repo. I hope 🙏.

If you have any reasonable PR you are welcome 🤘

Install

npm

npm install vue2-perfect-scrollbar

yarn

yarn add vue2-perfect-scrollbar

How to use

Global Registration

import PerfectScrollbar from 'vue2-perfect-scrollbar'
import 'vue2-perfect-scrollbar/dist/vue2-perfect-scrollbar.css'

Vue.use(PerfectScrollbar)

So then you can use this plugin in each component as

<perfect-scrollbar>
    <p> Lorem Ipsum is simply dummy text of the printing and typesetting industry. </p>
</perfect-scrollbar>

This plugin will generate a container with ".ps" class name, you need to customize the height of the container

/* example */
.ps {
  height: 400px;
}

Edit Vue Template

Global options

Install method takes additional parameters:

name {String}

Name of your global component.

Default: PerfectScrollbar

tag {String}

Tag which will be render as perfect scrollbar container

Default: div

watchOptions {Boolean}

Set true if you want to update perfect-scrollbar on options change

Default: false

options {Object}: Options

perfect-scrollbar options.

Default: {}

Local Registration

<template>
    <div>
        <perfect-scrollbar>
            <p> Lorem Ipsum is simply dummy text of the printing and typesetting industry. </p>
        </perfect-scrollbar>
    </div>
</template>
<script>
import { PerfectScrollbar } from 'vue2-perfect-scrollbar'
export default {
    components: {
        PerfectScrollbar
    }
}
</script>
<style src="vue2-perfect-scrollbar/dist/vue2-perfect-scrollbar.css"/>

Edit Vue Template

Props

tag {String}

Tag which will be render as perfect scrollbar container

Default: div

watchOptions {Boolean}

Set true if you want to update perfect-scrollbar on options change

Default: false

options {Object}: Options

perfect-scrollbar options.

Events

You can use Vue.js way to listen on the all perfect-scrollbar events. List of events you can find here

Simple example:

<template>
  <div id="app">
    <perfect-scrollbar @ps-scroll-y="onScroll" ref="scrollbar">
      <div>your content here</div>
    </perfect-scrollbar>
  </div>
</template>

<script>
export default {
  methods: {
    onScroll(event) {
      console.log(this.$refs.scrollbar.ps, event);
    }
  }
};
</script>

Edit Vue Perfect Scrollbar Event Listening

DEMO

https://mercs600.github.io/vue2-perfect-scrollbar/. You can also fork example from codesandbox

Cookbook

Custom scrollbar behavior with router.

One of simple solution to setup custom scrollbar to top when your route is changed.

  1. Add perfect scrollbar as wrapper for router-view and add simple ref
<perfect-scrollbar ref="scroll">
  <router-view></router-view>
</perfect-scrollbar>
  1. Add watch on $route to setup scroll container to 0, when route is changed.
watch: {
  $route() {
    this.$refs.scroll.$el.scrollTop = 0;
  }
}

Edit vue2-perfect-scrollbar with router

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].