|
|
@@ -44,7 +44,7 @@ export default {
|
|
44
|
44
|
data() {
|
|
45
|
45
|
return {
|
|
46
|
46
|
page: 1,
|
|
47
|
|
- perPage: 10
|
|
|
47
|
+ perPage: 9
|
|
48
|
48
|
}
|
|
49
|
49
|
},
|
|
50
|
50
|
computed: {
|
|
|
@@ -169,6 +169,16 @@ export default {
|
|
169
|
169
|
location.href = hashtag
|
|
170
|
170
|
}, TIMEOUT)
|
|
171
|
171
|
},
|
|
|
172
|
+ setIntersectionLoader() {
|
|
|
173
|
+ window.removeEventListener("load", e => {}, false)
|
|
|
174
|
+ window.addEventListener("load", e => {
|
|
|
175
|
+ const footerEl = document.querySelector(".footer-wrapper footer")
|
|
|
176
|
+ const observer = new IntersectionObserver(this.loadMorePosts, {
|
|
|
177
|
+ rootMargin: "0px 0px 20px 0px",
|
|
|
178
|
+ })
|
|
|
179
|
+ observer.observe(footerEl)
|
|
|
180
|
+ }, false)
|
|
|
181
|
+ }
|
|
172
|
182
|
},
|
|
173
|
183
|
watch: {
|
|
174
|
184
|
posts() {
|
|
|
@@ -189,20 +199,14 @@ export default {
|
|
189
|
199
|
if (!this[`all${type}Loaded`] || sort) this.getPosts(true)
|
|
190
|
200
|
|
|
191
|
201
|
// Add the infinite scroll load
|
|
192
|
|
- window.removeEventListener("load", e => {}, false)
|
|
193
|
|
- window.addEventListener("load", e => {
|
|
194
|
|
- const footerEl = document.querySelector(".footer-wrapper footer")
|
|
195
|
|
- const observer = new IntersectionObserver(this.loadMorePosts, {
|
|
196
|
|
- rootMargin: "0px 0px -20px 0px",
|
|
197
|
|
- })
|
|
198
|
|
- observer.observe(footerEl)
|
|
199
|
|
- }, false)
|
|
|
202
|
+ this.setIntersectionLoader()
|
|
200
|
203
|
},
|
|
201
|
204
|
},
|
|
202
|
205
|
mounted() {
|
|
203
|
206
|
if (this.$route.hash) {
|
|
204
|
207
|
setTimeout(() => this.scrollTo(this.$route.hash), TIMEOUT)
|
|
205
|
208
|
}
|
|
|
209
|
+ this.setIntersectionLoader()
|
|
206
|
210
|
},
|
|
207
|
211
|
created() {
|
|
208
|
212
|
let type = convertTitleCase(this.type) + 's'
|