routes.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import Home from '@/pages/Home'
  2. import TextOptions from '@/pages/_partials/TextOptions'
  3. export default [
  4. {
  5. name: 'home',
  6. path: '/',
  7. component: Home
  8. },
  9. {
  10. name: 'introduction',
  11. path: '/intro',
  12. component: () => import(/* webpackChunkName: "intro" */ '@/pages/Introduction')
  13. },
  14. {
  15. name: 'contact',
  16. path: '/contact',
  17. component: () => import(/* webpackChunkName: "contact" */ '@/pages/Contact')
  18. },
  19. {
  20. name: 'library',
  21. path: '/library',
  22. components: {
  23. default: () => import(/* webpackChunkName: "library" */ '@/pages/Library'),
  24. options: TextOptions
  25. },
  26. props: {
  27. default: ({ query }) => {
  28. let { mode = 'tree-map', texts = [] } = query
  29. if (typeof texts === 'string') texts = [texts]
  30. // In case of a reload or direct link, vue-router doesn't turn the query string into an array.
  31. if (texts && texts.length && typeof texts[0] === 'string') {
  32. texts = texts.map(text => text.split(',').map(id => parseInt(id)))
  33. }
  34. return { mode, texts }
  35. },
  36. options: ({ query }) => ({
  37. show: !('texts' in query && query.texts.length)
  38. })
  39. }
  40. },
  41. {
  42. name: 'kit',
  43. path: '/kit',
  44. component: () => import(/* webpackChunkName: "kit" */ '@/pages/Kit')
  45. },
  46. {
  47. name: 'gallery',
  48. path: '/gallery',
  49. component: () => import(/* webpackChunkName: "gallery" */ '@/pages/Gallery')
  50. },
  51. {
  52. name: 'blog',
  53. path: '/blog',
  54. component: () => import(/* webpackChunkName: "blog" */ '@/pages/Blog')
  55. },
  56. // TEMP
  57. {
  58. name: 'map',
  59. path: '/map',
  60. component: () => import(/* webpackChunkName: "test" */ '@/pages/Map')
  61. },
  62. {
  63. name: 'notfound',
  64. path: '/404',
  65. alias: '*',
  66. component: () => import(/* webpackChunkName: "404" */ '@/pages/NotFound.vue')
  67. }
  68. ]