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