Sfoglia il codice sorgente

:recycle: setting intersection loader with any init

tags/0.9.0
J 4 anni fa
parent
commit
acdbb29e84
1 ha cambiato i file con 6 aggiunte e 19 eliminazioni
  1. 6
    19
      vue-theme/src/pages/list.vue

+ 6
- 19
vue-theme/src/pages/list.vue Vedi File

@@ -195,12 +195,11 @@ export default {
195 195
             // Clear any preloaded posts (from home, etc.)
196 196
             this.clearAllPosts()
197 197
             this.loadMorePosts()
198
-        },
199
-        routeInfoFromPath(fullPath) {
200
-            const [ potentialType, potentialSort ] = fullPath.split('/').filter(e =>  e)
201
-            return {
202
-                sortBy: Object.values(sortTypes).includes(potentialSort) ? potentialSort : null,
203
-                type: postTypes.includes(potentialType) ? potentialType : null
198
+
199
+            // Always unset and reset the intersection loader
200
+            this.unsetIntersectionLoader()
201
+            if(!toPathInfo.sortBy != sortTypes.material) {
202
+                this.setIntersectionLoader()
204 203
             }
205 204
         }
206 205
     },
@@ -212,23 +211,11 @@ export default {
212 211
 
213 212
             console.log('init from type watch...')
214 213
             this.clearAndInitPostList()
215
-        },
216
-        $route(to, from) {
217
-            console.log('---')
218
-            const toPathInfo = this.routeInfoFromPath(to.fullPath)
219
-            const fromPathInfo = this.routeInfoFromPath(from.fullPath)
220
-            console.log('to :', toPathInfo)
221
-            console.log('from :', fromPathInfo)
222
-            
223
-            // Always unset and reset the intersection loader
224
-            this.unsetIntersectionLoader()
225
-            if(!toPathInfo.sortBy != sortTypes.material) {
226
-                this.setIntersectionLoader()
227
-            }
228 214
         }
229 215
     },
230 216
     mounted() {
231 217
         console.log('init from mounted...')
218
+        // This only fires navigating from a single page, to a list page
232 219
         this.clearAndInitPostList()
233 220
     },
234 221
     beforeDestroy() {

Loading…
Annulla
Salva