Giter Club home page Giter Club logo

v-bar's Introduction

VBar

The virtual responsive crossbrowser scrollbar component for VueJS 2x

DEMO

Usage

Install

Using NPM
npm i v-bar
Using yarn
yarn add v-bar

In your .vue component create a class to your wrapper

Using SASS
<style lang="sass">
    .wrapper
        height: 300px
        width: 300px
</style>
Simple CSS
<style>
    .wrapper {
        height: 300px;
        width: 300px;
    }
</style>

Include the component in your template

Using Simple HTML
<template>
    <v-bar wrapper="wrapper"
        vBar=""
        vBarInternal=""
        hBar=""
        hBarInternal="">
        <!-- your content -->
    </v-bar>
</template>

Import component

<script>
    import VBar from 'v-bar'

    # Declare
    export default {
        components: { VBar }
    }
</script>

Options

VBar is fully customizable. You can use your CSS classes to make it even more beautiful :)

*required* wrapper=""
*optional* vBar=""
*optional* vBarInternal=""
*optional* hBar=""
*optional* hBarInternal=""

To contribute and make it better

Clone the repo, change what you want and send PR

Contributions are always welcome!

Build Setup

# install dependencies
# using NPM
npm install

# using yarn
yarn

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report

Contributors

Luigui Delyer

https://github.com/luiguild

Carlo Fragni

https://github.com/carlofragni

SoullessWaffle

https://github.com/SoullessWaffle

Robbe Clerckx

https://github.com/robbeman

antshil

https://github.com/antshil

Henrique Deodato

https://github.com/h3nr1ke

v-bar's People

Contributors

dependabot[bot] avatar h3nr1ke avatar luiguild avatar mickdekkers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

v-bar's Issues

pug-plain-loader

Library have template on pug, but don't have pug-plain-loader in devDependencies. So I have install it separately. You should put it to devDependencies in library package.json file.

Using without Webpack

How I can use this plugin without importing it with Webpack? I want to build it in a single JS file.

Uncaught SyntaxError: Unexpected token <

I met a problem when I use v-bar with [email protected]. It is like this:

/Users/wuyiqing/Desktop/data-manager-front-end/node_modules/v-bar/src/components/v-bar.vue:1 
Uncaught SyntaxError: Unexpected token <
    at Object.exports.runInThisContext (vm.js:78)
    at Module._compile (module.js:543)
    at Object.Module._extensions..js (module.js:580)
    at Module.load (module.js:488)
    at tryModuleLoad (module.js:447)
    at Function.Module._load (module.js:439)
    at Module.require (module.js:498)
    at require (internal/module.js:20)
    at eval (webpack-internal:///90:1)
    at Object.<anonymous> (renderer.js:1281)

At first, I thought it was because of the version of vue. But it was not work when I changed the Vue to 2.3.3.

TypeError: Cannot read property '__resizeTriggers__' of undefined

I use the v-bar in part of my app and it worked great. When I created a second for use in a different .vue file, I get the error below when it tried to display. Do I need to register the component globally?


webpack-internal:///./node_modules/vue/dist/vue.esm.js:1697 TypeError: Cannot read property 'resizeTriggers' of undefined
at addResizeListener (webpack-internal:///./node_modules/detect-resize/lib/index.js:132)
at VueComponent.mounted (webpack-internal:///./node_modules/v-bar/node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/selector.js?type=script&index=0&bustCache!./node_modules/v-bar/src/components/v-bar.vue:162)
at callHook (webpack-internal:///./node_modules/vue/dist/vue.esm.js:2869)
at Object.insert (webpack-internal:///./node_modules/vue/dist/vue.esm.js:4046)
at invokeInsertHook (webpack-internal:///./node_modules/vue/dist/vue.esm.js:5802)

failing in console with chrome 59.0.3071.115

With Chrome Versión 59.0.3071.115 (Build oficial) (64 bits) it works but show in web developer console:
Uncaught SyntaxError: Invalid shorthand property initializer
Uncaught SyntaxError: Invalid shorthand property initializer
Uncaught SyntaxError: Invalid shorthand property initializer
Uncaught SyntaxError: Invalid shorthand property initializer

Scrollbar very slow

When I scroll with the mouse, it feels like the scroll-bar slows down. Any way to fix it?
Another question in case of adding more item in a div (with v-for) is the scroll-bar resized?

Scrollbar top snaps to cursor

In the demo page the top of the scrollbar snaps to the cursor position when you grab it. The scrollbar should be given a negative offset according to the position where it has been grabbed.

[Vue warn]: Error in destroyed hook after switching page with vue router

TypeError: Cannot read property '__resizeListeners__' of undefined at removeResizeListener (eval at <anonymous> (app.js:1087), <anonymous>:154:12) at VueComponent.destroyed (eval at <anonymous> (app.js:919), <anonymous>:40:99) at callHook (eval at <anonymous> (app.js:721), <anonymous>:2274:21) at VueComponent.Vue.$destroy (eval at <anonymous> (app.js:721), <anonymous>:2096:5) at pruneCacheEntry (eval at <anonymous> (app.js:721), <anonymous>:4057:29) at VueComponent.destroyed (eval at <anonymous> (app.js:721), <anonymous>:4078:7) at callHook (eval at <anonymous> (app.js:721), <anonymous>:2274:21) at VueComponent.Vue.$destroy (eval at <anonymous> (app.js:721), <anonymous>:2096:5) at destroy (eval at <anonymous> (app.js:721), <anonymous>:2963:33) at invokeDestroyHook (eval at <anonymous> (app.js:721), <anonymous>:4778:59)

this looks simular: link

top-refresh / pull refresh

Hello,
how to detect the event when you arrive at the top v-bar? For example, I would like to make a call when I get to the top of the scroll bar (make a top to refresh)

Thank you.

slice Error after build with webpack

When i change the components inside the wrapper i got this warning.
While in dev mode i dont get this warning, only after build.

[Vue warn]: Error in beforeDestroy hook: "TypeError: Cannot read property 'splice' of undefined"

found in

---> <VBar> at node_modules/v-bar/src/components/v-bar.vue
       <Forms> at src/components/forms/Entry.vue
         <Forms> at src/views/Forms.vue
           <App> at src/components/App.vue
             <Root>

TypeError: Cannot read property 'splice' of undefined
    at removeResizeListener (index.js:154)
    at VueComponent.beforeDestroy (eval at ./node_modules/babel-loader/lib/index.js?{"cacheDirectory":true,"babelrc":true}!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./node_modules/v-bar/src/components/v-bar.vue (forms-bundle.chunk.js:12), <anonymous>:175:84)
    at callHook (vue.runtime.esm.js:2662)
    at VueComponent.Vue.$destroy (vue.runtime.esm.js:2451)
    at destroy (vue.runtime.esm.js:3543)
    at invokeDestroyHook (vue.runtime.esm.js:5271)
    at invokeDestroyHook (vue.runtime.esm.js:5276)
    at VueComponent.patch [as __patch__] (vue.runtime.esm.js:5557)
    at VueComponent.Vue.$destroy (vue.runtime.esm.js:2474)
    at destroy (vue.runtime.esm.js:3543)

Any ideia?

vBarInternal is not working

<v-bar wrapper="scrolled-container"
               vBar="v-bar"
               vBarInternal="v-bar-internal">...</v-bar>
.v-bar {
        background: none !important;
}

.v-bar-internal {
        background: red !important;
}

This code is not working. And unfortunately you didn't add examples how to customize it.

[Question] Is there anyway to have access to the listeners?

Hey Luigui, I am trying out your package and it looks really awesome so far :)

I have two questions tho:

  1. Is there any way to access the scroll listeners?
    Very much like the "perfect-scrollbar" package does. This could be useful to implement infinite scrolls :)

  2. How would you advice to make the scroll start at the bottom?
    Asking this because I'm trying to pair this directive with your package. No success so far, the scroll doesn't want to go to the bottom :)

Thanks.

Unexpected token <

By simply importing module...

/node_modules/v-bar/src/components/v-bar.vue:1
(function (exports, require, module, __filename, __dirname) { <style scoped lang="sass">
                                                              ^

SyntaxError: Unexpected token <

build fails while using web pack

Getting the following error:

ERROR in ./~/css-loader?sourceMap!./~/vue-loader/lib/style-rewriter.js?id=data-v-4350943e&scoped=true!./~/sass-loader/lib/loader.js!./~/vue-loader/lib/selector.js?type=styles&index=0!./~/v-bar/src/components/v-bar.vue
Module build failed:
    @import ../sass/bar

My web pack.config.js:

var path = require('path');
var webpack = require('webpack');

module.exports = {
  entry: {
    main: './src/main.js',
    vue: 'vue',
    'vue-bundle': './src/vue.bundle.js'
  },
  output: {
    path: path.resolve(__dirname, './dist'),
    publicPath: '/dist/',
    filename: 'js/[name].js'
  },
  plugins: [
    new webpack.optimize.CommonsChunkPlugin({
      // names: ['vue', 'vuex', 'vue-router', 'vue-router-sync', 'manifest']
      names: ['vue', 'vue-bundle', 'manifest']
    })
  ],
  module: {
    rules: [{
        test: /\.vue$/,
        loader: 'vue-loader',
        options: {
          // vue-loader options go here
          'scss': 'vue-style-loader!css-loader!sass-loader',
          'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
        }
      },
      {
        test: /\.js$/,
        loader: 'babel-loader',
        exclude: /node_modules/
      },
      {
        test: /\.(png|jpg|gif|svg)$/,
        loader: 'file-loader',
        options: {
          name: './img/[name].[ext]'
        }
      }
    ]
  },
  resolve: {
    alias: {
      'vue$': 'vue/dist/vue.common.js'
    }
  },
  devServer: {
    historyApiFallback: true,
    noInfo: true
  },
  devtool: '#eval-source-map'
}

I've tried to put all sass styles inside of the component but that didn't help either.

Fix v-bar at the bottom

Hello,
I'm working on a chat and I want to fix the conversation on the last message.
I want the scroll bar to be at the bottom of the chat room
May you have a solution for me please ?

On click scrollbar show error in chrome or IE.

You can see this bug in demo

Uncaught TypeError: Cannot read property 'offsetTop' of undefined
    at a.startDrag (app.469ed2d6a8e1cda9b93f.js:272)
    at n (vue.esm.js:124)
    at HTMLDivElement.t (vue.esm.js:1656)

It's because e.explicitOriginalTarget works only in firefox.
How can fix it?
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.