- Add the repo
npm install vue-underscore
OR
yarn add vue-underscore
- Create a file named plugins/underscore.js
import Vue from 'vue'
import underscore from 'vue-underscore'
Vue.use(underscore)
- Add it to the nuxtconfig.js file
plugins: [{ src: '~/plugins/underscore', ssr: false }]
- Use it
<script>
export default {
name: 'MyComponent',
mounted() {
console.log(this.$_.range(2000, 2020))
}
}
</script>