Bläddra i källkod

feat: special route case for episodes | feat: remove sidebar for episodes list

tags/0.9.0
J 6 år sedan
förälder
incheckning
456d9a954f
3 ändrade filer med 7 tillägg och 6 borttagningar
  1. 2
    1
      vue-theme/src/index.js
  2. 2
    2
      vue-theme/src/pages/list.vue
  3. 3
    3
      vue-theme/src/pages/single.vue

+ 2
- 1
vue-theme/src/index.js Visa fil

@@ -13,8 +13,9 @@ const router = new VueRouter({
13 13
     mode: 'history',
14 14
     routes: [
15 15
         { path: '/', component: IndexPage },
16
+        { path: '/episodes', component: () => import(/* webpackChunkName: "pages-list" */ './pages/list.vue'), props: { sidebar: false } },
16 17
         { path: '/:type', component: () => import(/* webpackChunkName: "pages-list" */ './pages/list.vue'), props: { sidebar: true } },
17
-        { path: '/:type/:id', component: () => import(/* webpackChunkName: "pages-single" */ './pages/single.vue'), props: { sidebar: true } },
18
+        { path: '/:type/:slug', component: () => import(/* webpackChunkName: "pages-single" */ './pages/single.vue'), props: { sidebar: true } },
18 19
     ]
19 20
 })
20 21
 

+ 2
- 2
vue-theme/src/pages/list.vue Visa fil

@@ -35,7 +35,7 @@ export default {
35 35
             allEpisodesLoaded: 'allEpisodesLoaded',
36 36
         }),
37 37
         posts() {
38
-            let type = this.$route.params.type
38
+            let type = this.$route.params.type ? this.$route.params.type : this.$route.fullPath.slice(1)
39 39
             type = type.charAt(0).toUpperCase() + type.slice(1)
40 40
             return this[`all${type}`]
41 41
         },
@@ -47,7 +47,7 @@ export default {
47 47
         }
48 48
     },
49 49
     mounted() {
50
-        let type = this.$route.params.type
50
+        let type = this.$route.params.type ? this.$route.params.type : this.$route.fullPath.slice(1)
51 51
         type = type.charAt(0).toUpperCase() + type.slice(1)
52 52
         this.$store.dispatch(`getAll${type}`)
53 53
     }

+ 3
- 3
vue-theme/src/pages/single.vue Visa fil

@@ -2,10 +2,10 @@
2 2
 .page--single.f-row.between
3 3
     article.f-grow
4 4
         header
5
-            h1 {{ $route.params.type }}:{{ $route.params.id }} single
5
+            h1 {{ $route.params.type }}:{{ $route.params.slug }} single
6 6
         section
7
-            h4 {{ posts[$route.params.id].title }}
8
-            .block-wrapper(v-for="block in posts[$route.params.id].blocks" v-html="block")
7
+            h4 {{ posts[$route.params.slug].title }}
8
+            .block-wrapper(v-for="block in posts[$route.params.slug].blocks" v-html="block")
9 9
     //- COMPONENT: Make this with a prop
10 10
     aside(v-if="sidebar").shadow.b-radius
11 11
         header

Laddar…
Avbryt
Spara