There are the usual ways to install the plugin; using cdn, NPM, and Bower. We are going to use the terminal to install it via NPM:
npm install vue-router
Type this command in your terminal to have it installed in your node modules folder inside your project's directory. After it is complete, go to your main.js
file and add the following lines:
src/main.js
:
import VueRouter from 'vue-router' Vue.use(VueRouter)
You can install a Vue.js plugin using Vue.use()
as shown. For more information about Vue.use
check the guide: http://vuejs.org/api/#Vue-use.