Skip to content

Commit

Permalink
Add keyList watch
Browse files Browse the repository at this point in the history
  • Loading branch information
beomy committed May 22, 2019
1 parent ce7da74 commit 7cd16f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/js/vue-fast-scroll.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions src/FastScroll.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ export default {
this.fastScrollToggleId = setTimeout((x) => {
this.fastScrollToggle = false
}, this.mergedOptions.toggleDurationTime)
},
keyList () {
this.$nextTick(() => {
this.setFastScrollIndex()
})
}
},
Expand Down Expand Up @@ -112,8 +118,8 @@ export default {
setFastScrollIndex () {
for (const item of this.keyList) {
const clientReact = this.$refs.indexList.querySelector(`[fast-scroll-key="${item.key}"]`).getBoundingClientRect()
this.fastScrollIndex[item.key] = clientReact.y + clientReact.height
const clientRect = this.$refs.indexList.querySelector(`[fast-scroll-key="${item.key}"]`).getBoundingClientRect()
this.fastScrollIndex[item.key] = clientRect.y + clientRect.height
}
}
}
Expand Down

0 comments on commit 7cd16f0

Please sign in to comment.