{"action":"closed","issue":{"url":"https://api.github.com/repos/vuejs/vue-router/issues/952","repository_url":"https://api.github.com/repos/vuejs/vue-router","labels_url":"https://api.github.com/repos/vuejs/vue-router/issues/952/labels{/name}","comments_url":"https://api.github.com/repos/vuejs/vue-router/issues/952/comments","events_url":"https://api.github.com/repos/vuejs/vue-router/issues/952/events","html_url":"https://github.com/vuejs/vue-router/issues/952","id":192168043,"number":952,"title":"vue-router单独配置router.js，在主js中引用，路由不起作用","user":{"login":"jiangchengshi","id":21210629,"avatar_url":"https://avatars.githubusercontent.com/u/21210629?v=3","gravatar_id":"","url":"https://api.github.com/users/jiangchengshi","html_url":"https://github.com/jiangchengshi","followers_url":"https://api.github.com/users/jiangchengshi/followers","following_url":"https://api.github.com/users/jiangchengshi/following{/other_user}","gists_url":"https://api.github.com/users/jiangchengshi/gists{/gist_id}","starred_url":"https://api.github.com/users/jiangchengshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiangchengshi/subscriptions","organizations_url":"https://api.github.com/users/jiangchengshi/orgs","repos_url":"https://api.github.com/users/jiangchengshi/repos","events_url":"https://api.github.com/users/jiangchengshi/events{/privacy}","received_events_url":"https://api.github.com/users/jiangchengshi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-29T01:59:22Z","updated_at":"2016-11-29T07:58:03Z","closed_at":"2016-11-29T07:58:03Z","body":"- main.js\r\n\r\nimport Routers from \"./router.admin\";\r\nVue.use(VueRouter);\r\nconst router = new VueRouter({});\r\nRouters(router);\r\n\r\n- router.admin.js\r\n\r\nimport Main from '../components/admin/main.vue';\r\nimport User from '../components/admin/user/user.vue';\r\nimport UserRole from '../components/admin/user/user_role.vue';\r\nimport RoleAuthority from '../components/admin/user/role_authority.vue';\r\n\r\nexport default function (router) {\r\n    const routes = [\r\n        {\r\n            name: 'main',\r\n            path: '/',\r\n            component: Main\r\n        },\r\n        {\r\n            name: 'user',\r\n            path: '/user',\r\n            component: User\r\n        },\r\n        {\r\n            name: 'user_role',\r\n            path: '/user_role',\r\n            component: UserRole\r\n        },\r\n        {\r\n            name: 'role_authority',\r\n            path: '/role_authority',\r\n            component: RoleAuthority\r\n        }\r\n    ];\r\n    router.options.routes = routes;\r\n    router.beforeEach((to, from, next) => {\r\n        console.info('next...');\r\n        console.info(to);\r\n        console.info(from);\r\n        console.info('next..');\r\n        next();\r\n    });\r\n}"}}
{"actor":{"display_login":"yyx990803"}}