gabogabans
gabogabans

Reputation: 3553

Add js library to Vue prototype?

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

Upvotes: 0

Views: 64

Answers (1)

Nikolay Yankov
Nikolay Yankov

Reputation: 376

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>

Upvotes: 1

Related Questions