Created
December 9, 2019 14:36
-
-
Save webislife/6d20676046e7acfe6e02660a41b3ef6f to your computer and use it in GitHub Desktop.
Router example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Router from 'vue-router'; | |
import MarketingRoutes from '@client/router/marketing.js'; | |
import HotelsRoutes from '@client/router/hotels.js'; | |
const BaseLayout = () => import( /* webpackChunkName: "layout/base" */ '@client/layouts/base.vue'); | |
const EmptyLayout = () => import( /* webpackChunkName: "layout/empty" */ '@client/layouts/empty.vue'); | |
const LkLayout = () => import( /* webpackChunkName: "layout/lk" */ '@client/layouts/lk/index.vue'); | |
export const routes = [ | |
...MarketingRoutes, | |
...HotelsRoutes, | |
{ | |
path: '/', | |
component: BaseLayout, | |
children: [ | |
{ | |
name: 'home', | |
path: '', | |
component: () => import(/* webpackChunkName: "route/main" */ './routes/main.vue'), | |
}, | |
], | |
}, | |
{ | |
path: '/oauth', | |
component: BaseLayout, | |
children: [ | |
{ | |
name: 'oauth', | |
path: ':network', | |
meta: { | |
ignoreGtm: true, | |
ignoreYa: true, | |
ignoreFb: true, | |
}, | |
component: () => import(/* webpackChunkName: "route/oauth/index" */ './routes/oauth/index.vue'), | |
}, | |
], | |
}, | |
{ | |
path: '/blog', | |
component: BaseLayout, | |
children: [ | |
{ | |
name: 'blog', | |
path: '', | |
component: () => import(/* webpackChunkName: "route/blog" */ './routes/blog.vue'), | |
}, | |
], | |
}, | |
{ | |
path: '/search', | |
component: BaseLayout, | |
sitemap: true, | |
children: [ | |
{ | |
name: 'search', | |
path: '', | |
component: () => import(/* webpackChunkName: "route/search" */ './routes/search/index.vue'), | |
}, | |
], | |
}, | |
{ | |
path: '/brands', | |
component: BaseLayout, | |
children: [ | |
{ | |
name: 'brands', | |
path: '', | |
component: () => import(/* webpackChunkName: "route/brands" */ './routes/brands/index.vue'), | |
}, | |
{ | |
name: 'brand', | |
path: ':slug/:view?', | |
component: () => import(/* webpackChunkName: "route/brand" */ './routes/brands/view.vue'), | |
}, | |
] | |
}, | |
{ | |
path: '/auth', | |
component: EmptyLayout, | |
children: [ | |
{ | |
name: 'auth', | |
path: '', | |
component: () => import(/* webpackChunkName: "route/auth" */ './routes/auth/index.vue'), | |
}, | |
], | |
}, | |
{ | |
path: '/500', | |
component: EmptyLayout, | |
children: [ | |
{ | |
name: '500', | |
path: '', | |
component: () => import(/* webpackChunkName: "route/auth" */ './routes/500.vue'), | |
}, | |
], | |
}, | |
{ | |
path: '/offline', | |
component: EmptyLayout, | |
children: [ | |
{ | |
name: 'offline', | |
path: '', | |
component: () => import(/* webpackChunkName: "route/offline" */ './routes/offline.vue'), | |
}, | |
], | |
}, | |
{ | |
path: '/reminder', | |
component: EmptyLayout, | |
children: [ | |
{ | |
name: 'reminder', | |
path: '', | |
component: () => import(/* webpackChunkName: "route/reminder" */ './routes/reminder.vue'), | |
}, | |
], | |
}, | |
{ | |
path: '/user', | |
component: BaseLayout, | |
children: [ | |
{ | |
path: '/', | |
component: LkLayout, | |
children: [ | |
{ | |
path: '', | |
name: 'user-home', | |
component: () => import(/* webpackChunkName: "route/lk/home" */ '@client/routes/lk/home/index.vue'), | |
}, { | |
name: 'user-promocodes', | |
path: 'promocodes', | |
component: () => import(/* webpackChunkName: "route/lk/promocodes" */ '@client/routes/lk/promocodes/index.vue'), | |
}, { | |
name: 'user-password', | |
path: 'password', | |
component: () => import(/* webpackChunkName: "route/lk/password" */ '@client/routes/lk/password/index.vue'), | |
}, { | |
name: 'user-history', | |
path: 'history', | |
component: () => import(/* webpackChunkName: "route/lk/history" */ '@client/routes/lk/history/index.vue'), | |
}, { | |
name: 'user-subscribe', | |
path: 'subscribe', | |
component: () => import(/* webpackChunkName: "route/lk/subscribe" */ '@client/routes/lk/subscribe/index.vue'), | |
}, { | |
name: 'user-profile', | |
path: 'profile', | |
component: () => import(/* webpackChunkName: "route/lk/profile" */ '@client/routes/lk/profile/index.vue'), | |
}, { | |
name: 'user-coupons', | |
path: 'coupons', | |
component: () => import(/* webpackChunkName: "route/lk/coupons" */ '@client/routes/lk/coupons/index.vue'), | |
}, | |
], | |
}, | |
], | |
}, | |
{ | |
path: '/information/faq', | |
sitemap: true, | |
component: BaseLayout, | |
children: [ | |
{ | |
name: 'faq', | |
path: '', | |
component: () => import(/* webpackChunkName: "route/faq" */ './routes/faq/index.vue'), | |
}, | |
], | |
}, | |
{ | |
path: '/company', | |
sitemap: true, | |
component: BaseLayout, | |
children: [ | |
{ | |
name: 'how-it-works', | |
path: 'how_it_works', | |
component: () => import(/* webpackChunkName: "route/company/how_it_works/" */ './routes/company/how_it_works/index.vue'), | |
}, | |
], | |
}, | |
{ | |
path: '/partners', | |
sitemap: true, | |
component: EmptyLayout, | |
children: [ | |
{ | |
name: 'forBusiness', | |
path: 'for_business', | |
component: () => import(/* webpackChunkName: "route/partners/for_business" */ '@client/routes/partners/for_business/index.vue'), | |
}, | |
], | |
}, | |
{ | |
path: '*', | |
component: BaseLayout, | |
children: [ | |
{ | |
name: '404', | |
path: '*', | |
component: () => import(/* webpackChunkName: "route/404" */ './routes/404.vue'), | |
}, | |
], | |
}, | |
]; | |
export function createRouter() { | |
return new Router({ | |
mode: 'history', | |
routes | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment