Commit 0f0a9fe6103686d8ed02500aa620b3588ed3571d
1 parent
77a67f5d
fix cannot read offset of undefined on anchor component
Showing
1 changed file
with
3 additions
and
1 deletions
Show diff stats
src/components/anchor/anchor.vue
... | ... | @@ -168,7 +168,9 @@ export default { |
168 | 168 | this.handleScrollTo(); |
169 | 169 | this.handleSetInkTop(); |
170 | 170 | this.updateTitleOffset(); |
171 | - this.upperFirstTitle = this.scrollElement.scrollTop < this.titlesOffsetArr[0].offset; | |
171 | + if (this.titlesOffsetArr[0]) { | |
172 | + this.upperFirstTitle = this.scrollElement.scrollTop < this.titlesOffsetArr[0].offset; | |
173 | + } | |
172 | 174 | on(this.scrollContainer, 'scroll', this.handleScroll); |
173 | 175 | on(window, 'hashchange', this.handleHashChange); |
174 | 176 | }); | ... | ... |