import Vue from "vue"; import VueRouter from 'vue-router'; import Star from '../components/Star'; import HelloWorld from '../components/HelloWorld'; import MyMenu from '../components/MyMenu'; import b from '../components/b'; import a from '../components/a'; import c from '../components/c'; import ss from '../components/ss'; import xx from '../components/xx' import detail from '../components/detail.vue' Vue.use(VueRouter); var router = new VueRouter({ routes : [{ path: '/a', name:'a', component: a, children:[ // { // path:'', // redirect:{name:"x"} // }, { path:'x/:type', //动态路由 name:'x', component:xx, } ] }, { path: '/b', component: b, }, { path: '/c', component: c }, { path:'/a/x/:type/:id', //直接这样写才行 写成子类不行 name:'detail', component:detail } ] }) export default router;