Explorar el Código

:recycle: trying intersection listener on route change instead

tags/0.9.0
J hace 4 años
padre
commit
4e3a4f64db
Se han modificado 1 ficheros con 10 adiciones y 12 borrados
  1. 10
    12
      vue-theme/src/pages/list.vue

+ 10
- 12
vue-theme/src/pages/list.vue Ver fichero

@@ -187,24 +187,22 @@ export default {
187 187
             }
188 188
 
189 189
             if (!this[`all${type}Loaded`] || sort) this.getPosts(true)
190
+
191
+            // 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)
190 200
         },
191 201
     },
192 202
     mounted() {
193 203
         if (this.$route.hash) {
194 204
             setTimeout(() => this.scrollTo(this.$route.hash), TIMEOUT)
195 205
         }
196
-
197
-        // Add the infinite scroll load
198
-        window.addEventListener("load", e => {
199
-            const footerEl = document.querySelector(".footer-wrapper footer")
200
-            const observer = new IntersectionObserver(this.loadMorePosts, {
201
-                rootMargin: "0px 0px 50px 0px",
202
-            })
203
-            observer.observe(footerEl)
204
-        }, false)
205
-    },
206
-    unmounted() {
207
-        window.removeEventListener("load", e => {}, false)
208 206
     },
209 207
     created() {
210 208
         let type = convertTitleCase(this.type) + 's'

Loading…
Cancelar
Guardar