Просмотр исходного кода

:poop: adding clear hero mixin

tags/0.9.0
J 4 лет назад
Родитель
Сommit
d2f4f34df3
2 измененных файлов: 14 добавлений и 6 удалений
  1. 11
    6
      vue-theme/src/pages/list.vue
  2. 3
    0
      vue-theme/src/pages/mixin-post-types.js

+ 11
- 6
vue-theme/src/pages/list.vue Просмотреть файл

@@ -101,10 +101,13 @@ export default {
101 101
             const dispatchAction = clear ? `getAll${this.pType}` : `getMore${this.pType}`
102 102
             // pType sometimes is undefined so need to dispatch and
103 103
             let res = null
104
+
104 105
             // Episodes only needs load call
105 106
             if(this.pType && dispatchAction != `getMoreEpisodes`) {
106
-                console.log('d:', dispatchAction, this._getDispatchParams())
107
-                res = await this.$store.dispatch(dispatchAction, this._getDispatchParams())
107
+                res = await this.$store.dispatch(
108
+                    dispatchAction,
109
+                    this._getDispatchParams()
110
+                )
108 111
             }
109 112
 
110 113
             // Stop trying to load more posts
@@ -139,13 +142,13 @@ export default {
139 142
         setIntersectionLoader() {
140 143
             console.warn('setting up intersection handler for:', this.type)
141 144
             window.removeEventListener("load", e => {}, false)
142
-            console.warn('all intersection handlers:', window)
145
+
143 146
             const footerEl = document.querySelector(".footer-wrapper footer")
144 147
             if(!footerEl) return
145 148
 
146 149
             window.addEventListener("load", e => {
147 150
                 const observer = new IntersectionObserver(this.loadMorePosts, {
148
-                    rootMargin: "0px 0px -20px 0px",
151
+                    rootMargin: "0px 0px 20px 0px",
149 152
                 })
150 153
                 observer.observe(footerEl)
151 154
             }, false)
@@ -167,10 +170,12 @@ export default {
167 170
             this.setIntersectionLoader()
168 171
         },
169 172
     },
170
-    created() {
171
-        console.log('--- List page ---')
173
+    mounted() {
172 174
         this.setIntersectionLoader()
173 175
     },
176
+    created() {
177
+        console.log('--- List page ---')
178
+    }
174 179
 }
175 180
 </script>
176 181
 

+ 3
- 0
vue-theme/src/pages/mixin-post-types.js Просмотреть файл

@@ -59,6 +59,9 @@ const heroUtils = {
59 59
             json.text = post && post.excerpt ? post.excerpt : post.title
60 60
             return json
61 61
         },
62
+        _clearHero(store) {
63
+            store.commit('SET_HERO', { url: null, heroType: null })
64
+        }
62 65
     }
63 66
 }
64 67
 export { postTypeGetters, scrollTop, heroUtils }

Загрузка…
Отмена
Сохранить