index.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. // import Cart from 'vuejs/components/Pages/Cart'
  11. Vue.use(VueRouter)
  12. // https://www.lullabot.com/articles/decoupled-hard-problems-routing
  13. // We could use aliases to never reload the page on language changement
  14. // BUT beforeupdate is not triggered when push alias instead of path or name
  15. // const languages = ['en', 'fr'];
  16. // console.log('path aliases', (() => languages.map(l => `/${l}/base`))())
  17. const basePath = drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix
  18. const routes = [
  19. {
  20. name: 'home',
  21. path: basePath,
  22. // path: '/',
  23. // alias: (() => languages.map(l => `/${l}`))(),
  24. component: Home
  25. // components: {
  26. // 'home': Home
  27. // }
  28. },
  29. {
  30. name: 'base',
  31. path: `${basePath}base`,
  32. // path: `/base`,
  33. // alias: (() => languages.map(l => `/${l}/base`))(),
  34. component: Base
  35. // components: {
  36. // 'base': Base
  37. // }
  38. },
  39. {
  40. name: 'thematique',
  41. path: `${basePath}thematique/:alias`,
  42. component: Thematique
  43. },
  44. {
  45. name: 'blabla',
  46. path: `${basePath}blabla`,
  47. component: Blabla
  48. },
  49. {
  50. name: 'article',
  51. path: `${basePath}blabla/:alias`,
  52. component: Article
  53. // meta: { uuid:null }
  54. },
  55. {
  56. name: 'showrooms',
  57. path: `${basePath}showrooms`,
  58. component: Showrooms
  59. // meta: { uuid:null }
  60. },
  61. // {
  62. // path: '*',
  63. // name: 'notfound',
  64. // components: {
  65. // 'notfound': NotFound
  66. // }
  67. // },
  68. {
  69. name: 'pricing',
  70. path: `${basePath}pricing`,
  71. component: Pricing
  72. }
  73. // {
  74. // name:'cart',
  75. // path: `${basePath}cart`,
  76. // component: Cart
  77. // }
  78. ]
  79. export default new VueRouter({
  80. mode: 'history',
  81. routes: routes
  82. })