fix(scrollbar): add some guard statement for $refs access

This commit is contained in:
07akioni 2019-07-31 17:41:49 +08:00
parent 8fd1cdb694
commit f3bea75a3d

View File

@ -218,17 +218,23 @@ export default {
this.updateScrollParameters()
},
updateScrollParameters () {
if (this.$refs.scrollContainer) {
this.containerScrollTop = this.$refs.scrollContainer.scrollTop
this.containerScrollLeft = this.$refs.scrollContainer.scrollLeft
}
},
updatePositionParameters () {
/**
* Don't use getClientBoundingRect because element may be scale transformed
*/
if (this.$refs.scrollContent) {
this.contentHeight = this.$refs.scrollContent.offsetHeight
this.contentWidth = this.$refs.scrollContent.offsetWidth
}
if (this.$refs.scrollContainer) {
this.containerHeight = this.$refs.scrollContainer.offsetHeight
this.containerWidth = this.$refs.scrollContainer.offsetWidth
}
},
updateParameters () {
this.updatePositionParameters()