1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| import Vue from 'vue' import vueRouter from 'vue-router' import home from '../components/home.vue' import about from '../components/about.vue' import User from '../components/User' const food = () => import ("../components/HomeFood.vue"); const clothes = () => import ("../components/HomeClothes.vue"); Vue.use(vueRouter);
const routes = [{ path: "/", name: home, redirect: "/home", component: home, }, { path: "/home", name: home, component: home, children: [{ path: "food", name: food, component: food }, { path: "clothes", name: clothes, component: clothes } ]
}, { path: "/about", name: about, component: about }, { path: "/User/:userId", component: User, name: User, } ];
const router = new vueRouter({ routes, mode: 'history', linkActiveClass: "active" })
export default router;
|