0

I have an app which uses vue and laravel with laravel mix, I installed a js library called ProgressBar.js via npm install, however now I don't know how to use that library in my .vue files, how can I use the library inside my single file components, maybe adding it to the vue prototype, but how can I require it now?

https://progressbarjs.readthedocs.io/en/latest/#install

1 Answer 1

1

If you started your Vue app with vue create command, you can simply import it in your App.vue. Example:

<script>
import ProgressBar from 'progressbar.js'

export default {
  mounted() {
    const line = new ProgressBar.Line('#container')
  }
}
</scirpt>
Sign up to request clarification or add additional context in comments.

3 Comments

I actually do something like this: const app = new Vue({ el: '#vueapp', store,
Is it just in plain html file your new Vue instance?
If it's simply an HTML file, then you have add a <script> tag with src to node_modules/progressbar.js/dist/progressbar.js and then use it directly from window in your Vue instance. window.Progressbar

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.