index.js 2.1 KB

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