There is a large ecosystem of 3rd party libraries you can use with Vue.
Generally, the process to use them is this:
- you install the library using npm or yarn (
npm install ...-
yarn add ...)
- you import the library in your Vue component.
If you’re using Vue CLI like we did up to now, you’re already set up to use ES Modules, which means you can import any package using:
import somepackage from 'somepackage'
Some libraries require you to import them the main Vue component (which we call App in the examples) and then run
Vue.use() to install it:
import vue-moment from 'vue-moment' Vue.use(require('vue-moment'))
Some other libraries can just be imported into the component where you want to use them.