|
|
@@ -53,8 +53,8 @@ export default {
|
|
53
|
53
|
return typeFromRoute(this.$route)
|
|
54
|
54
|
},
|
|
55
|
55
|
pType() {
|
|
56
|
|
- if(!this.type) return
|
|
57
|
|
- return this.sortBy ? `${convertTitleCase(this.type.split('/')[0])}s` : `${convertTitleCase(this.type)}s`
|
|
|
56
|
+ if(!typeFromRoute(this.$route)) return
|
|
|
57
|
+ return this.sortBy ? `${convertTitleCase(typeFromRoute(this.$route).split('/')[0])}s` : `${convertTitleCase(this.type)}s`
|
|
58
|
58
|
},
|
|
59
|
59
|
loaded() {
|
|
60
|
60
|
if (!this.pType) return
|
|
|
@@ -67,8 +67,11 @@ export default {
|
|
67
|
67
|
},
|
|
68
|
68
|
methods: {
|
|
69
|
69
|
loadMorePosts() {
|
|
70
|
|
- if(!this.type) return console.warn(`type: ${this.type} not found...`)
|
|
71
|
|
- console.warn(`loading more ${this.type} posts...`)
|
|
|
70
|
+ console.log(this.$route)
|
|
|
71
|
+ const type = typeFromRoute(this.$route)
|
|
|
72
|
+ if(!type) return console.warn(`type: ${type} not found...`)
|
|
|
73
|
+
|
|
|
74
|
+ console.warn(`loading more ${type} posts...`)
|
|
72
|
75
|
this.page++
|
|
73
|
76
|
this.getPosts({ clear: false })
|
|
74
|
77
|
},
|
|
|
@@ -151,34 +154,31 @@ export default {
|
|
151
|
154
|
}
|
|
152
|
155
|
},
|
|
153
|
156
|
watch: {
|
|
154
|
|
- $route: {
|
|
155
|
|
- handler: (to, from) => {
|
|
156
|
|
- // Filter the path to remove blank strings and
|
|
157
|
|
- // only grab the hero if moving to another list page
|
|
158
|
|
- // eg. list page -> list page
|
|
159
|
|
- const path = to.fullPath.split('/').filter(p => p)
|
|
160
|
|
- console.log('to:', path)
|
|
161
|
|
- console.log('?:', path.pop())
|
|
162
|
|
- console.log('?:', path.pop())
|
|
163
|
|
-
|
|
164
|
|
- // Always reset the page count
|
|
165
|
|
- this.page = 0
|
|
166
|
|
-
|
|
167
|
|
- // this.checkAndSetHero(this.type)
|
|
168
|
|
-
|
|
169
|
|
- // Load first page of results
|
|
170
|
|
- // this.getPosts({ clear: false })
|
|
171
|
|
- console.log("route", to, from)
|
|
172
|
|
- // this.setIntersectionLoader()
|
|
173
|
|
- },
|
|
174
|
|
- deep: true
|
|
|
157
|
+ $route(to, from) {
|
|
|
158
|
+ // Filter the path to remove blank strings and
|
|
|
159
|
+ // only grab the hero if moving to another list page
|
|
|
160
|
+ // eg. list page -> list page
|
|
|
161
|
+ // const path = to.fullPath.split('/').filter(p => p)
|
|
|
162
|
+ // console.log('to:', path)
|
|
|
163
|
+ // console.log('?:', path.pop())
|
|
|
164
|
+ // console.log('?:', path.pop())
|
|
|
165
|
+
|
|
|
166
|
+ // Always reset the page count
|
|
|
167
|
+ this.page = 0
|
|
|
168
|
+
|
|
|
169
|
+ // this.checkAndSetHero(this.type)
|
|
|
170
|
+
|
|
|
171
|
+ // Load first page of results
|
|
|
172
|
+ // this.getPosts({ clear: false })
|
|
|
173
|
+ console.log("route", to, from)
|
|
|
174
|
+ // this.setIntersectionLoader()
|
|
175
|
175
|
},
|
|
176
|
176
|
},
|
|
177
|
177
|
mounted() {
|
|
178
|
|
- this.setIntersectionLoader()
|
|
179
|
178
|
},
|
|
180
|
179
|
created() {
|
|
181
|
180
|
console.log('--- liiiist ---')
|
|
|
181
|
+ this.setIntersectionLoader()
|
|
182
|
182
|
// this.checkAndSetHero(this.type)
|
|
183
|
183
|
},
|
|
184
|
184
|
}
|