Commit 52830ca693aee7d37d05fda6b0c4060c2ee7ad23

Authored by Aresn
Committed by GitHub
2 parents abb2cae6 be2640b3

Merge pull request #2624 from SergioCrisostomo/check-for-element-before

check for element before using it
Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
src/components/scroll/scroll.vue
@@ -228,8 +228,8 @@ @@ -228,8 +228,8 @@
228 }, 228 },
229 229
230 onScroll() { 230 onScroll() {
231 - if (this.isLoading) return;  
232 const el = this.$refs.scrollContainer; 231 const el = this.$refs.scrollContainer;
  232 + if (this.isLoading || !el) return;
233 const scrollDirection = Math.sign(this.lastScroll - el.scrollTop); // IE has no Math.sign, check that webpack polyfills this 233 const scrollDirection = Math.sign(this.lastScroll - el.scrollTop); // IE has no Math.sign, check that webpack polyfills this
234 const displacement = el.scrollHeight - el.clientHeight - el.scrollTop; 234 const displacement = el.scrollHeight - el.clientHeight - el.scrollTop;
235 235