1//Installing Vue Router
2npm install vue-router
3
4//Implementation
5//main.js - Add below lines
6import VueRouter from 'vue-router';
7
8Vue.use(VueRouter);
9
10const router = new VueRouter({
11 routes,
12 mode: 'history'
13});
14
15new Vue({
16 router,
17 render: h => h(App)
18}).$mount('#app')
19
20//App.vue - Add below line in v-content
21/*
22<template>
23 <v-app>
24 <v-content>
25 <router-view></router-view>
26 </v-content>
27 </v-app>
28</template>
29*/
30
31//route.js - We need to craate file under src
32import linkName from './components/fileName.vue';
33export const routes = [
34 {
35 path: '/',
36 component: linkName
37 }
38]
1cd [project]
2npm install --save vue-router // install only on the project that we are in