瀏覽代碼

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

tags/1.0.0^2
maeda 3 年之前
父節點
當前提交
782cf14785
共有 1 個文件被更改,包括 13 次插入5 次删除
  1. 13
    5
      vue-theme/src/pages/list.vue

+ 13
- 5
vue-theme/src/pages/list.vue 查看文件

5
         header.center.t-up
5
         header.center.t-up
6
             .title.f-row
6
             .title.f-row
7
                 h3(v-if="!isSearch") {{ type }}s 
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
                 span(v-if="sortBy")
11
                 span(v-if="sortBy")
10
                     h3 {{ sortBy.replace('-', ' ') }}
12
                     h3 {{ sortBy.replace('-', ' ') }}
11
 
13
 
60
         type() {
62
         type() {
61
             return postTypes.includes(this.$route.params.type) ? this.$route.params.type : 'post'
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
         sortBy() {
68
         sortBy() {
64
             return this.$route.params.sortBy
69
             return this.$route.params.sortBy
65
         },
70
         },
145
                 this.loadingFetched = true
150
                 this.loadingFetched = true
146
                 this.page++
151
                 this.page++
147
                 console.log('shouldLoadAll :', this.shouldLoadAllAtOnce, this.type)
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
                 const res = await getPosts(
160
                 const res = await getPosts(
149
-                    {
150
-                        limit: this.shouldLoadAllAtOnce ? -1 : this.perPage,
151
-                        page: this.page
152
-                    },
153
                     this.shouldLoadAllAtOnce ? 'All' : 'More'
161
                     this.shouldLoadAllAtOnce ? 'All' : 'More'
154
                 )
162
                 )
155
                 this.loadingFetched = false
163
                 this.loadingFetched = false

Loading…
取消
儲存