Bläddra i källkod

:recycle: re-init on from OR no sort

tags/0.9.0
J 4 år sedan
förälder
incheckning
3fef9a9b37
1 ändrade filer med 9 tillägg och 1 borttagningar
  1. 9
    1
      vue-theme/src/pages/list.vue

+ 9
- 1
vue-theme/src/pages/list.vue Visa fil

@@ -196,10 +196,18 @@ export default {
196 196
         },
197 197
         $route(to, from) {
198 198
             // Check if we changed sort method
199
+            // from no sort to sorted
200
+            // or sorted to no sort
201
+            // or sort to a different sort(?)
199 202
             console.log('to:', to.fullPath.includes(this.sortBy))
200 203
             console.log('from:', from.fullPath.includes(this.sortBy))
201 204
             console.log('sort:', this.sortBy)
202
-            if(to.fullPath.includes(this.sortBy) || from.fullPath.includes(this.sortBy)) { this.clearAndInitPostList() }
205
+            if(
206
+                from.fullPath.includes(this.sortBy) ||
207
+                (!to.fullPath.includes(this.sortBy) && !from.fullPath.includes(this.sortBy))
208
+            ) {
209
+                this.clearAndInitPostList()
210
+            }
203 211
         }
204 212
     },
205 213
     mounted() {

Laddar…
Avbryt
Spara