materio-d9/web/themes/custom/materiotheme/vuejs/route/index.js

137 lines
3.3 KiB
JavaScript
Raw Normal View History

import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from 'vuejs/components/Pages/Home'
// import Base from 'vuejs/components/Pages/Base'
// import Thematique from 'vuejs/components/Pages/Thematique'
// import Blabla from 'vuejs/components/Pages/Blabla'
// import Article from 'vuejs/components/Pages/Article'
// import Showrooms from 'vuejs/components/Pages/Showrooms'
// import Pricing from 'vuejs/components/Pages/Pricing'
// const Home = () => import(
// /* webpackMode: "lazy" */
// /* webpackPrefetch: true */
// /* webpackPreload: true */
// 'vuejs/components/Pages/Home')
const Base = () => import(
/* webpackChunkName: "module-base" */
/* webpackMode: "lazy" */
/* webpackPrefetch: true */
/* webpackPreload: true */
'vuejs/components/Pages/Base')
const Thematique = () => import(
/* webpackChunkName: "module-thematique" */
/* webpackMode: "lazy" */
/* webpackPrefetch: true */
/* webpackPreload: true */
'vuejs/components/Pages/Thematique')
const Blabla = () => import(
/* webpackChunkName: "module-blabla" */
/* webpackMode: "lazy" */
/* webpackPrefetch: true */
/* webpackPreload: true */
'vuejs/components/Pages/Blabla')
const Article = () => import(
/* webpackChunkName: "module-article" */
/* webpackMode: "lazy" */
/* webpackPrefetch: true */
/* webpackPreload: true */
'vuejs/components/Pages/Article')
const Showrooms = () => import(
/* webpackChunkName: "module-showrooms" */
/* webpackMode: "lazy" */
/* webpackPrefetch: true */
/* webpackPreload: true */
'vuejs/components/Pages/Showrooms')
const Pricing = () => import(
/* webpackChunkName: "module-pricing" */
/* webpackMode: "lazy" */
/* webpackPrefetch: true */
/* webpackPreload: true */
'vuejs/components/Pages/Pricing')
Vue.use(VueRouter)
// https://www.lullabot.com/articles/decoupled-hard-problems-routing
// We could use aliases to never reload the page on language changement
// BUT beforeupdate is not triggered when push alias instead of path or name
// const languages = ['en', 'fr'];
// console.log('path aliases', (() => languages.map(l => `/${l}/base`))())
const basePath = drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix
const routes = [
{
name: 'home',
path: basePath,
// path: '/',
// alias: (() => languages.map(l => `/${l}`))(),
component: Home
// components: {
// 'home': Home
// }
},
{
name: 'base',
path: `${basePath}base`,
// path: `/base`,
// alias: (() => languages.map(l => `/${l}/base`))(),
component: Base
// components: {
// 'base': Base
// }
},
2020-12-25 17:37:15 +01:00
{
name: 'thematique',
path: `${basePath}thematique/:alias`,
component: Thematique
},
{
name: 'blabla',
path: `${basePath}blabla`,
component: Blabla
},
{
name: 'article',
path: `${basePath}blabla/:alias`,
component: Article
// meta: { uuid:null }
},
{
name: 'showrooms',
path: `${basePath}showrooms`,
component: Showrooms
// meta: { uuid:null }
2019-10-05 20:01:06 +02:00
},
// {
// path: '*',
// name: 'notfound',
// components: {
// 'notfound': NotFound
// }
2019-10-05 20:01:06 +02:00
// },
{
name: 'pricing',
2019-10-05 20:01:06 +02:00
path: `${basePath}pricing`,
component: Pricing
}
2019-10-07 17:32:14 +02:00
// {
// name:'cart',
// path: `${basePath}cart`,
// component: Cart
// }
]
export default new VueRouter({
mode: 'history',
routes: routes
})