Skip to content

Commit 41b734a

Browse files
mariusawoothu
authored andcommitted
refactor: make 'export default new Router' more readable (coreui#164)
make export default new Router more readable by separating routes into a configRoutes() function
1 parent 213b7c4 commit 41b734a

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/router/index.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,8 @@ const User = () => import('@/views/users/User')
6060

6161
Vue.use(Router)
6262

63-
export default new Router({
64-
mode: 'hash', // https://router.vuejs.org/api/#mode
65-
linkActiveClass: 'open active',
66-
scrollBehavior: () => ({ y: 0 }),
67-
routes: [
63+
function configRoutes() {
64+
return [
6865
{
6966
path: '/',
7067
redirect: '/dashboard',
@@ -333,4 +330,11 @@ export default new Router({
333330
]
334331
}
335332
]
333+
}
334+
335+
export default new Router({
336+
mode: 'hash', // https://router.vuejs.org/api/#mode
337+
linkActiveClass: 'open active',
338+
scrollBehavior: () => ({ y: 0 }),
339+
routes: configRoutes()
336340
})

0 commit comments

Comments
 (0)