|
|
@@ -32,7 +32,7 @@ import card from '@/components/card'
|
|
32
|
32
|
import sidebar from '@/components/sidebars/sidebar'
|
|
33
|
33
|
import { postTypeGetters, scrollTop, heroUtils } from './mixin-post-types'
|
|
34
|
34
|
|
|
35
|
|
-import { convertTitleCase, typeFromRoute } from '@/utils/helpers'
|
|
|
35
|
+import { postTypes, convertTitleCase, typeFromRoute } from '@/utils/helpers'
|
|
36
|
36
|
|
|
37
|
37
|
const TIMEOUT = 1
|
|
38
|
38
|
|
|
|
@@ -140,8 +140,11 @@ export default {
|
|
140
|
140
|
this.$store.commit('SET_HERO', this._setHeroInfo(page))
|
|
141
|
141
|
},
|
|
142
|
142
|
setIntersectionLoader() {
|
|
|
143
|
+ if(!this.type) return console.error('cannot setup interseciton handler for undefined type')
|
|
|
144
|
+
|
|
143
|
145
|
console.warn('setting up intersection handler for:', this.type)
|
|
144
|
146
|
const footerEl = document.querySelector(".footer-wrapper footer")
|
|
|
147
|
+ console.warn('attach to: ',footerEl)
|
|
145
|
148
|
if(!footerEl) return
|
|
146
|
149
|
|
|
147
|
150
|
window.addEventListener("load", e => {
|
|
|
@@ -163,7 +166,6 @@ export default {
|
|
163
|
166
|
// Clear any preloaded posts (from home, etc.)
|
|
164
|
167
|
this.clearAllPosts()
|
|
165
|
168
|
this.loadMorePosts()
|
|
166
|
|
- this.setIntersectionLoader()
|
|
167
|
169
|
}
|
|
168
|
170
|
},
|
|
169
|
171
|
watch: {
|
|
|
@@ -172,11 +174,14 @@ export default {
|
|
172
|
174
|
type(newType, oldType){
|
|
173
|
175
|
console.log('old:', oldType)
|
|
174
|
176
|
console.log('new:', newType)
|
|
|
177
|
+ if(!postTypes.includes(newType)) return console.warn('type not found...')
|
|
175
|
178
|
this.clearAndInitPostList()
|
|
|
179
|
+ this.setIntersectionLoader()
|
|
176
|
180
|
},
|
|
177
|
181
|
},
|
|
178
|
182
|
mounted() {
|
|
179
|
183
|
this.clearAndInitPostList()
|
|
|
184
|
+ this.setIntersectionLoader()
|
|
180
|
185
|
},
|
|
181
|
186
|
beforeUnmount() {
|
|
182
|
187
|
this.unsetIntersectionLoader()
|