Ver código fonte

Merge branch '192-subtype' of craft-in-america/vue-wp into dev

tags/1.0.0^2
maeda 3 anos atrás
pai
commit
782cf14785
1 arquivos alterados com 13 adições e 5 exclusões
  1. 13
    5
      vue-theme/src/pages/list.vue

+ 13
- 5
vue-theme/src/pages/list.vue Ver arquivo

@@ -5,7 +5,9 @@
5 5
         header.center.t-up
6 6
             .title.f-row
7 7
                 h3(v-if="!isSearch") {{ type }}s 
8
-                h3(v-else) Search results for: {{$route.query.s }} 
8
+                h3(v-else-if="!subtype") {{ type }}: {{ subtype }}s 
9
+                h3(v-else-if="isSearch") Search results for: {{$route.query.s }} 
10
+                h3(v-else) {{ type }}s 
9 11
                 span(v-if="sortBy")
10 12
                     h3 {{ sortBy.replace('-', ' ') }}
11 13
 
@@ -60,6 +62,9 @@ export default {
60 62
         type() {
61 63
             return postTypes.includes(this.$route.params.type) ? this.$route.params.type : 'post'
62 64
         },
65
+        subtype() {
66
+            return this.$route.query.subtype
67
+        },
63 68
         sortBy() {
64 69
             return this.$route.params.sortBy
65 70
         },
@@ -145,11 +150,14 @@ export default {
145 150
                 this.loadingFetched = true
146 151
                 this.page++
147 152
                 console.log('shouldLoadAll :', this.shouldLoadAllAtOnce, this.type)
153
+                const params = {
154
+                    limit: this.shouldLoadAllAtOnce ? -1 : this.perPage,
155
+                    page: this.page
156
+                }
157
+                if(this.subtype) {
158
+                    params.type = this.subtype
159
+                }
148 160
                 const res = await getPosts(
149
-                    {
150
-                        limit: this.shouldLoadAllAtOnce ? -1 : this.perPage,
151
-                        page: this.page
152
-                    },
153 161
                     this.shouldLoadAllAtOnce ? 'All' : 'More'
154 162
                 )
155 163
                 this.loadingFetched = false

Carregando…
Cancelar
Salvar