routes.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import Home from '@/pages/Home'
  2. export default [
  3. {
  4. name: 'home',
  5. path: '/',
  6. component: Home
  7. },
  8. {
  9. name: 'introduction',
  10. path: '/intro',
  11. component: () => import(/* webpackChunkName: "intro" */ '@/pages/Introduction')
  12. },
  13. {
  14. name: 'contact',
  15. path: '/contact',
  16. component: () => import(/* webpackChunkName: "contact" */ '@/pages/Contact')
  17. },
  18. {
  19. name: 'library',
  20. path: '/library',
  21. components: {
  22. default: () => import(/* webpackChunkName: "library" */ '@/pages/Library'),
  23. options: () => import(/* webpackChunkName: "library" */ '@/pages/library/LibraryOptions')
  24. },
  25. props: {
  26. default: ({ query }) => {
  27. let { mode = 'tree-map', texts = [] } = query
  28. if (typeof texts === 'string') texts = [texts]
  29. // In case of a reload or direct link, vue-router doesn't turn the query string into an array.
  30. if (texts && texts.length && typeof texts[0] === 'string') {
  31. texts = texts.map(text => text.split(',').map(id => parseInt(id)))
  32. }
  33. return { mode, texts }
  34. },
  35. options: ({ query }) => ({
  36. show: !('texts' in query && query.texts.length),
  37. mode: query.mode || 'tree-map'
  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. ]