|
|
@@ -19,7 +19,7 @@
|
|
19
|
19
|
p {{ `${type} count: ${Object.values(posts).length}` }}
|
|
20
|
20
|
p {{ `show sidebar: ${sidebar}` }}
|
|
21
|
21
|
|
|
22
|
|
- sidebar(v-if="sidebar" :type="`${type}`" layout="list")
|
|
|
22
|
+ //- sidebar(v-if="sidebar" :type="`${type}`" layout="list")
|
|
23
|
23
|
|
|
24
|
24
|
</template>
|
|
25
|
25
|
|
|
|
@@ -43,7 +43,7 @@ export default {
|
|
43
|
43
|
mixins: [postTypeGetters, scrollTop],
|
|
44
|
44
|
data() {
|
|
45
|
45
|
return {
|
|
46
|
|
- page: 1,
|
|
|
46
|
+ page: 0,
|
|
47
|
47
|
perPage: 9
|
|
48
|
48
|
}
|
|
49
|
49
|
},
|
|
|
@@ -67,11 +67,13 @@ export default {
|
|
67
|
67
|
},
|
|
68
|
68
|
methods: {
|
|
69
|
69
|
loadMorePosts() {
|
|
70
|
|
- // console.log('loading...')
|
|
|
70
|
+ console.warn(`loading more ${this.type} posts...`)
|
|
71
|
71
|
this.page++
|
|
72
|
|
- this.getPosts(false)
|
|
|
72
|
+ this.getPosts({ clear: false })
|
|
73
|
73
|
},
|
|
74
|
74
|
async getPosts({ clear }) {
|
|
|
75
|
+
|
|
|
76
|
+ console.log('gp:', clear)
|
|
75
|
77
|
// Sorting
|
|
76
|
78
|
let sort = this.sortBy
|
|
77
|
79
|
? this.sortBy
|
|
|
@@ -87,13 +89,13 @@ export default {
|
|
87
|
89
|
page: this.page
|
|
88
|
90
|
}
|
|
89
|
91
|
}
|
|
90
|
|
-
|
|
91
|
92
|
const dispatchAction = clear ? `getAll${this.pType}` : `getMore${this.pType}`
|
|
92
|
93
|
|
|
93
|
94
|
// pType sometimes is undefined so need to dispatch and
|
|
94
|
95
|
// Episodes only needs load call
|
|
95
|
96
|
let res = null
|
|
96
|
97
|
if(this.pType && dispatchAction != `getMoreEpisodes`) {
|
|
|
98
|
+ console.log('d:', dispatchAction, dispatchParams)
|
|
97
|
99
|
res = await this.$store.dispatch(dispatchAction, dispatchParams)
|
|
98
|
100
|
}
|
|
99
|
101
|
|
|
|
@@ -150,31 +152,35 @@ export default {
|
|
150
|
152
|
}
|
|
151
|
153
|
},
|
|
152
|
154
|
watch: {
|
|
153
|
|
- $route(to) {
|
|
154
|
|
- // Filter the path to remove blank strings and
|
|
155
|
|
- // only grab the hero if moving to another list page
|
|
156
|
|
- // eg. list page -> list page
|
|
157
|
|
- const path = to.fullPath.split('/').filter(p => p)
|
|
158
|
|
- console.log('to:', path)
|
|
159
|
|
- console.log('?:', path.pop())
|
|
160
|
|
- console.log('?:', path.pop())
|
|
161
|
|
-
|
|
162
|
|
- // Always reset the page count
|
|
163
|
|
- this.page = 1
|
|
164
|
|
-
|
|
165
|
|
- this.checkAndSetHero(this.type)
|
|
166
|
|
-
|
|
167
|
|
- // Load first page of results
|
|
168
|
|
- this.getPosts({ clear: false })
|
|
169
|
|
-
|
|
170
|
|
- this.setIntersectionLoader()
|
|
|
155
|
+ $route: {
|
|
|
156
|
+ handler: (to, from) => {
|
|
|
157
|
+ // Filter the path to remove blank strings and
|
|
|
158
|
+ // only grab the hero if moving to another list page
|
|
|
159
|
+ // eg. list page -> list page
|
|
|
160
|
+ const path = to.fullPath.split('/').filter(p => p)
|
|
|
161
|
+ console.log('to:', path)
|
|
|
162
|
+ console.log('?:', path.pop())
|
|
|
163
|
+ console.log('?:', path.pop())
|
|
|
164
|
+
|
|
|
165
|
+ // Always reset the page count
|
|
|
166
|
+ this.page = 0
|
|
|
167
|
+
|
|
|
168
|
+ // this.checkAndSetHero(this.type)
|
|
|
169
|
+
|
|
|
170
|
+ // Load first page of results
|
|
|
171
|
+ // this.getPosts({ clear: false })
|
|
|
172
|
+ console.log("route", to, from)
|
|
|
173
|
+ // this.setIntersectionLoader()
|
|
|
174
|
+ },
|
|
|
175
|
+ deep: true
|
|
171
|
176
|
},
|
|
172
|
177
|
},
|
|
173
|
178
|
mounted() {
|
|
174
|
179
|
this.setIntersectionLoader()
|
|
175
|
180
|
},
|
|
176
|
181
|
created() {
|
|
177
|
|
- this.checkAndSetHero(this.type)
|
|
|
182
|
+ console.log('--- liiiist ---')
|
|
|
183
|
+ // this.checkAndSetHero(this.type)
|
|
178
|
184
|
},
|
|
179
|
185
|
}
|
|
180
|
186
|
</script>
|