routes.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. })
  38. }
  39. },
  40. {
  41. name: 'kit',
  42. path: '/kit',
  43. component: () => import(/* webpackChunkName: "kit" */ '@/pages/Kit')
  44. },
  45. {
  46. name: 'gallery',
  47. path: '/gallery',
  48. component: () => import(/* webpackChunkName: "gallery" */ '@/pages/Gallery')
  49. },
  50. {
  51. name: 'blog',
  52. path: '/blog',
  53. component: () => import(/* webpackChunkName: "blog" */ '@/pages/Blog')
  54. },
  55. // TEMP
  56. {
  57. name: 'map',
  58. path: '/map',
  59. component: () => import(/* webpackChunkName: "test" */ '@/pages/Map')
  60. },
  61. {
  62. name: 'notfound',
  63. path: '/404',
  64. alias: '*',
  65. component: () => import(/* webpackChunkName: "404" */ '@/pages/NotFound.vue')
  66. }
  67. ]