Selaa lähdekoodia

feat: wrapping getters in another getter

tags/0.9.0
J 6 vuotta sitten
vanhempi
commit
b149633aa8
2 muutettua tiedostoa jossa 15 lisäystä ja 3 poistoa
  1. 1
    1
      vue-theme/src/index.js
  2. 14
    2
      vue-theme/src/pages/list.vue

+ 1
- 1
vue-theme/src/index.js Näytä tiedosto

@@ -14,12 +14,12 @@ const router = new VueRouter({
14 14
     mode: 'history',
15 15
     routes: [
16 16
         { path: '/', component: IndexPage },
17
+        { path: '/lazy', component:  () => import(/* webpackChunkName: "pages-lazy" */ './pages/lazy.vue') },
17 18
         {
18 19
             path: '/:type',
19 20
             component: ListPage,
20 21
             props: { sidebar: true }
21 22
         },
22
-        { path: '/lazy', component:  () => import(/* webpackChunkName: "pages-lazy" */ './pages/lazy.vue') },
23 23
     ]
24 24
 })
25 25
 

+ 14
- 2
vue-theme/src/pages/list.vue Näytä tiedosto

@@ -9,6 +9,8 @@
9 9
             h4 {{ $route.params.type }}
10 10
             p {{ Object.values(allArtists).length }}
11 11
             p {{ sidebar }}
12
+        section(v-for="post in posts")
13
+            h4 {{ post.title }}
12 14
     //- COMPONENT: Make this with a prop
13 15
     aside(v-if="sidebar").shadow.b-radius
14 16
         header
@@ -29,9 +31,20 @@ export default {
29 31
         ...mapGetters({
30 32
             allArtists: 'allArtists',
31 33
             allArtistsLoaded: 'allArtistsLoaded',
34
+
32 35
             allEpisodes: 'allEpisodes',
33 36
             allEpisodesLoaded: 'allEpisodesLoaded',
34 37
         }),
38
+        posts() {
39
+            switch (this.$route.params.type) {
40
+                case 'artists':
41
+                    return this.allArtists
42
+                    break
43
+                case 'episodes':
44
+                    return this.allEpisodes
45
+                    break
46
+            }
47
+        },
35 48
     },
36 49
     data() {
37 50
         return {
@@ -44,11 +57,10 @@ export default {
44 57
             case 'artists':
45 58
                 this.$store.dispatch('getAllArtists')
46 59
                 break
47
-            case 'episodess':
60
+            case 'episodes':
48 61
                 this.$store.dispatch('getAllEpisodes')
49 62
                 break
50 63
         }
51
-        
52 64
     }
53 65
 }
54 66
 </script>

Loading…
Peruuta
Tallenna