import VueRouter from "vue-router"; const routes=[ { path:'/login', name:'login', component: () => import('../components/Login') }, { path:'/index', name:'index', component: () => import('../components/Index'), children:[ { path:'/home', name:'home', meta:{ title:'首页' }, component: () => import('../components/duochaxun/demo1.vue') }, { path:'/demo1', name:'demo1', meta:{ title:'测试1' }, component: () => import('@/components/duochaxun/demo1.vue') }, { path:'/demo2', name:'demo2', meta:{ title:'测试2' }, component: () => import('@/components/duochaxun/demo2.vue') } ] } ] const route=new VueRouter({ mode:'history', routes }) const VueRouterPush = VueRouter.prototype.push VueRouter.prototype.push = function push (to) { return VueRouterPush.call(this, to).catch(err => err) } export default route;