DominikSerafin/vuebar

Failed to resolve directive: bar

jankulma opened this issue · 6 comments

I am having really hard time trying to set up vuebar. All the CSS settings I have as recommended. I think there must be sth obvious I am missing, as I am novice with vue.

My code:

<template>
  <div id="app">
    <div class="content" v-bar>
      _lorem paragraphs..._
    </div>
  </div>
</template>

<script>
  export default {

  }
</script>

<style>
  #app {
    position: relative;
    overflow: hidden;
  }
  .content {
    overflow-x: hidden;
    overflow-y: scroll;
    height: 400px;
    -ms-overflow-style: scrollbar;
    width: 400px;
  }
</style>

The error in the console is:

[Vue warn]: Failed to resolve directive: bar
(found in <Anonymous>)

And the scrollbar stays unchanged. I use vue-cli with webpack, chrome browser, ubuntu os. Any suggestions?

How do you import and apply this plugin?

I install it via npm npm install vuebar --save

@jankulma this only adds the package to your project node_modules, but it doesnt't automatically install it. You need to import and install it in your main project entry point (e.g. main.js).

Like so:

import Vuebar from 'vuebar';
Vue.use(Vuebar);

Or:

var Vuebar = require('vuebar');
Vue.use(Vuebar);

This is what I am asking about =)

I was missing that. Thanks a lot.

@jankulma this only adds the package to your project node_modules, but it doesnt't automatically install it. You need to import and install it in your main project entry point (e.g. main.js).

Like so:

import Vuebar from 'vuebar';
Vue.use(Vuebar);

Or:

var Vuebar = require('vuebar');
Vue.use(Vuebar);

I am using the cdn way and I receive this same mistake.