Difference between revisions of "Routes.js File"
Jump to navigation
Jump to search
(Created page with "<pre> import User from './components/User.vue'; import UserDetail from './components/UserDetail.vue'; import UserEdit from './components/UserEdit.vue'; import UserStart from '...") |
|||
Line 6: | Line 6: | ||
import Home from './components/Home.vue'; | import Home from './components/Home.vue'; | ||
// The "children" keyword is an array which has the subroutes | |||
export const myRoutes = [ | export const myRoutes = [ | ||
{ path: '', component: Home }, | { path: '', component: Home }, |
Latest revision as of 17:16, 19 October 2018
import User from './components/User.vue'; import UserDetail from './components/UserDetail.vue'; import UserEdit from './components/UserEdit.vue'; import UserStart from './components/UserStart.vue'; import Home from './components/Home.vue'; // The "children" keyword is an array which has the subroutes export const myRoutes = [ { path: '', component: Home }, { path: '/user', component: User, children:[ {path: '', component: UserStart}, {path: ':id', component: UserDetail, beforeEnter:(to, from, next)=>{ console.log('inside rout setup'); next(); }}, {path: ':id/edit', component: UserEdit, name: 'userEdit'} ] }, {path: '/redirect-me', redirect: '/user'}, {path: '*', redirect: '/'} ];