From 0375542009938196c812ec6eeb8174d70706ba35 Mon Sep 17 00:00:00 2001 From: Pan Date: Thu, 31 May 2018 13:22:12 +0800 Subject: [PATCH] fix[Sticky]: fixed bug in resize #724 --- src/components/Sticky/index.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/Sticky/index.vue b/src/components/Sticky/index.vue index 103efdae..8dfa09be 100644 --- a/src/components/Sticky/index.vue +++ b/src/components/Sticky/index.vue @@ -29,7 +29,8 @@ export default { active: false, position: '', width: undefined, - height: undefined + height: undefined, + isSticky: false } }, mounted() { @@ -52,6 +53,7 @@ export default { this.position = 'fixed' this.active = true this.width = this.width + 'px' + this.isSticky = true }, reset() { if (!this.active) { @@ -60,6 +62,7 @@ export default { this.position = '' this.width = 'auto' this.active = false + this.isSticky = false }, handleScroll() { this.width = this.$el.getBoundingClientRect().width @@ -71,7 +74,9 @@ export default { this.reset() }, handleReize() { - this.width = this.$el.getBoundingClientRect().width + 'px' + if (this.isSticky) { + this.width = this.$el.getBoundingClientRect().width + 'px' + } } } }