index.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. import Home from 'vuejs/components/Pages/Home'
  4. // const Home = () => import(
  5. // /* webpackMode: "lazy" */
  6. // /* webpackPrefetch: true */
  7. // /* webpackPreload: true */
  8. // 'vuejs/components/Pages/Home')
  9. // // import Base from 'vuejs/components/Pages/Base'
  10. const Base = () => import(
  11. /* webpackChunkName: "module-base" */
  12. /* webpackMode: "lazy" */
  13. /* webpackPrefetch: true */
  14. /* webpackPreload: true */
  15. 'vuejs/components/Pages/Base')
  16. // import Thematique from 'vuejs/components/Pages/Thematique'
  17. const Thematique = () => import(
  18. /* webpackChunkName: "module-thematique" */
  19. /* webpackMode: "lazy" */
  20. /* webpackPrefetch: true */
  21. /* webpackPreload: true */
  22. 'vuejs/components/Pages/Thematique')
  23. // import Blabla from 'vuejs/components/Pages/Blabla'
  24. const Blabla = () => import(
  25. /* webpackChunkName: "module-blabla" */
  26. /* webpackMode: "lazy" */
  27. /* webpackPrefetch: true */
  28. /* webpackPreload: true */
  29. 'vuejs/components/Pages/Blabla')
  30. // import Article from 'vuejs/components/Pages/Article'
  31. const Article = () => import(
  32. /* webpackChunkName: "module-article" */
  33. /* webpackMode: "lazy" */
  34. /* webpackPrefetch: true */
  35. /* webpackPreload: true */
  36. 'vuejs/components/Pages/Article')
  37. // import Showrooms from 'vuejs/components/Pages/Showrooms'
  38. const Showrooms = () => import(
  39. /* webpackChunkName: "module-showrooms" */
  40. /* webpackMode: "lazy" */
  41. /* webpackPrefetch: true */
  42. /* webpackPreload: true */
  43. 'vuejs/components/Pages/Showrooms')
  44. // import Pricing from 'vuejs/components/Pages/Pricing'
  45. const Pricing = () => import(
  46. /* webpackChunkName: "module-pricing" */
  47. /* webpackMode: "lazy" */
  48. /* webpackPrefetch: true */
  49. /* webpackPreload: true */
  50. 'vuejs/components/Pages/Pricing')
  51. // import Cart from 'vuejs/components/Pages/Cart'
  52. Vue.use(VueRouter)
  53. // https://www.lullabot.com/articles/decoupled-hard-problems-routing
  54. // We could use aliases to never reload the page on language changement
  55. // BUT beforeupdate is not triggered when push alias instead of path or name
  56. // const languages = ['en', 'fr'];
  57. // console.log('path aliases', (() => languages.map(l => `/${l}/base`))())
  58. const basePath = drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix
  59. const routes = [
  60. {
  61. name: 'home',
  62. path: basePath,
  63. // path: '/',
  64. // alias: (() => languages.map(l => `/${l}`))(),
  65. component: Home
  66. // components: {
  67. // 'home': Home
  68. // }
  69. },
  70. {
  71. name: 'base',
  72. path: `${basePath}base`,
  73. // path: `/base`,
  74. // alias: (() => languages.map(l => `/${l}/base`))(),
  75. component: Base
  76. // components: {
  77. // 'base': Base
  78. // }
  79. },
  80. {
  81. name: 'thematique',
  82. path: `${basePath}thematique/:alias`,
  83. component: Thematique
  84. },
  85. {
  86. name: 'blabla',
  87. path: `${basePath}blabla`,
  88. component: Blabla
  89. },
  90. {
  91. name: 'article',
  92. path: `${basePath}blabla/:alias`,
  93. component: Article
  94. // meta: { uuid:null }
  95. },
  96. {
  97. name: 'showrooms',
  98. path: `${basePath}showrooms`,
  99. component: Showrooms
  100. // meta: { uuid:null }
  101. },
  102. // {
  103. // path: '*',
  104. // name: 'notfound',
  105. // components: {
  106. // 'notfound': NotFound
  107. // }
  108. // },
  109. {
  110. name: 'pricing',
  111. path: `${basePath}pricing`,
  112. component: Pricing
  113. }
  114. // {
  115. // name:'cart',
  116. // path: `${basePath}cart`,
  117. // component: Cart
  118. // }
  119. ]
  120. export default new VueRouter({
  121. mode: 'history',
  122. routes: routes
  123. })