Last active
April 15, 2020 21:25
-
-
Save braian125/6c9a34001686635debbd42b5c8ed6546 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//router/index.js | |
import Vue from "vue"; | |
import Router from "vue-router"; | |
Vue.use(Router); | |
const router = new Router({ | |
mode: "history", | |
routes: [ | |
{ | |
path: "/", | |
name: "", | |
redirect: "home", | |
component: () => | |
import( | |
/* webpackChunkName: "about" */ "@/containers/dashboard/Dashboard" | |
), | |
children: [ | |
{ | |
path: "/home", | |
name: "home", | |
component: () => | |
import(/* webpackChunkName: "home" */ "./../views/Home"), | |
}, | |
{ | |
path: "posts", | |
name: "", | |
component: { | |
render(c) { | |
return c("router-view"); | |
}, | |
}, | |
children: [ | |
{ | |
path: "", | |
name: "post", | |
component: () => | |
import(/* webpackChunkName: "posts" */ "./../views/Posts"), | |
}, | |
{ | |
path: ":id(\\d+)?", | |
name: "post-view", | |
component: () => | |
import( | |
/* webpackChunkName: "post-details" */ "./../views/PostDetail" | |
), | |
}, | |
], | |
}, | |
], | |
}, | |
{ | |
path: "/login", | |
name: "login", | |
component: () => | |
import(/* webpackChunkName: "login" */ "./../views/Login"), | |
}, | |
], | |
}); | |
router.mode = "html5"; | |
export default router; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment