vue router push
//Syntax - this.$router.push(path);
this.$router.push("/path");
vue router push
//Syntax - this.$router.push(path);
this.$router.push("/path");
vue router implementation
//Implementation
//main.js - Add below lines
import VueRouter from 'vue-router';
Vue.use(VueRouter);
const router = new VueRouter({
routes,
mode: 'history'
});
new Vue({
router,
render: h => h(App)
}).$mount('#app')
//App.vue - Add below line in v-content
/*
<template>
<v-app>
<v-content>
<router-view></router-view>
</v-content>
</v-app>
</template>
*/
//route.js - We need to craate file under src
import linkName from './components/fileName.vue';
export const routes = [
{
path: '/',
component: linkName
}
]
navbar route with params vue
//if we have a route that admits params via url:
{path : '/page/:id?', name='page', component: Page},
//we can edit the url to show the params we want like this:
<router-link :to="{name: 'page', params:{id: 'hello'}}"> </router-link>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us