Procházet zdrojové kódy

:poop: dumbing it way down

tags/0.9.0
J před 4 roky
rodič
revize
010946e6ca
1 změnil soubory, kde provedl 30 přidání a 24 odebrání
  1. 30
    24
      vue-theme/src/pages/list.vue

+ 30
- 24
vue-theme/src/pages/list.vue Zobrazit soubor

19
             p {{ `${type} count: ${Object.values(posts).length}` }}
19
             p {{ `${type} count: ${Object.values(posts).length}` }}
20
             p {{ `show sidebar: ${sidebar}` }}
20
             p {{ `show sidebar: ${sidebar}` }}
21
         
21
         
22
-    sidebar(v-if="sidebar" :type="`${type}`" layout="list")
22
+    //- sidebar(v-if="sidebar" :type="`${type}`" layout="list")
23
     
23
     
24
 </template>
24
 </template>
25
 
25
 
43
     mixins: [postTypeGetters, scrollTop],
43
     mixins: [postTypeGetters, scrollTop],
44
     data() {
44
     data() {
45
         return {
45
         return {
46
-            page: 1,
46
+            page: 0,
47
             perPage: 9
47
             perPage: 9
48
         }
48
         }
49
     },
49
     },
67
     },
67
     },
68
     methods: {
68
     methods: {
69
         loadMorePosts() {
69
         loadMorePosts() {
70
-            // console.log('loading...')
70
+            console.warn(`loading more ${this.type} posts...`)
71
             this.page++
71
             this.page++
72
-            this.getPosts(false)
72
+            this.getPosts({ clear: false })
73
         },
73
         },
74
         async getPosts({ clear }) {
74
         async getPosts({ clear }) {
75
+            
76
+            console.log('gp:', clear)
75
             // Sorting
77
             // Sorting
76
             let sort = this.sortBy
78
             let sort = this.sortBy
77
                 ? this.sortBy
79
                 ? this.sortBy
87
                     page: this.page
89
                     page: this.page
88
                 }
90
                 }
89
             }
91
             }
90
-
91
             const dispatchAction = clear ? `getAll${this.pType}` : `getMore${this.pType}`
92
             const dispatchAction = clear ? `getAll${this.pType}` : `getMore${this.pType}`
92
 
93
 
93
             // pType sometimes is undefined so need to dispatch and
94
             // pType sometimes is undefined so need to dispatch and
94
             // Episodes only needs load call
95
             // Episodes only needs load call
95
             let res = null
96
             let res = null
96
             if(this.pType && dispatchAction != `getMoreEpisodes`) {
97
             if(this.pType && dispatchAction != `getMoreEpisodes`) {
98
+                console.log('d:', dispatchAction, dispatchParams)
97
                 res = await this.$store.dispatch(dispatchAction, dispatchParams)
99
                 res = await this.$store.dispatch(dispatchAction, dispatchParams)
98
             }
100
             }
99
 
101
 
150
         }
152
         }
151
     },
153
     },
152
     watch: {
154
     watch: {
153
-        $route(to) {
154
-            // Filter the path to remove blank strings and
155
-            // only grab the hero if moving to another list page
156
-            // eg. list page -> list page
157
-            const path = to.fullPath.split('/').filter(p => p)
158
-            console.log('to:', path)
159
-            console.log('?:', path.pop())
160
-            console.log('?:', path.pop())
161
-
162
-            // Always reset the page count
163
-            this.page = 1
164
-            
165
-            this.checkAndSetHero(this.type)
166
-            
167
-            // Load first page of results
168
-            this.getPosts({ clear: false })
169
-
170
-            this.setIntersectionLoader()
155
+        $route: {
156
+            handler: (to, from) => {
157
+                // Filter the path to remove blank strings and
158
+                // only grab the hero if moving to another list page
159
+                // eg. list page -> list page
160
+                const path = to.fullPath.split('/').filter(p => p)
161
+                console.log('to:', path)
162
+                console.log('?:', path.pop())
163
+                console.log('?:', path.pop())
164
+    
165
+                // Always reset the page count
166
+                this.page = 0
167
+                
168
+                // this.checkAndSetHero(this.type)
169
+                
170
+                // Load first page of results
171
+                // this.getPosts({ clear: false })
172
+                console.log("route", to, from)
173
+                // this.setIntersectionLoader()
174
+            },
175
+            deep: true
171
         },
176
         },
172
     },
177
     },
173
     mounted() {
178
     mounted() {
174
         this.setIntersectionLoader()
179
         this.setIntersectionLoader()
175
     },
180
     },
176
     created() {
181
     created() {
177
-        this.checkAndSetHero(this.type)
182
+        console.log('--- liiiist ---')
183
+        // this.checkAndSetHero(this.type)
178
     },
184
     },
179
 }
185
 }
180
 </script>
186
 </script>

Načítá se…
Zrušit
Uložit