index.js 3.3 KB

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