From 03e5f762b3892bf2eac800b690844ad7b0a8867e Mon Sep 17 00:00:00 2001
From: Pan <panfree23@gmail.com>
Date: Thu, 31 May 2018 10:49:11 +0800
Subject: [PATCH] fix[Sticky]: fixed bug in resize #721

---
 src/components/Sticky/index.vue | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/components/Sticky/index.vue b/src/components/Sticky/index.vue
index 2c9657be..103efdae 100644
--- a/src/components/Sticky/index.vue
+++ b/src/components/Sticky/index.vue
@@ -28,22 +28,21 @@ export default {
     return {
       active: false,
       position: '',
-      currentTop: '',
       width: undefined,
-      height: undefined,
-      child: null,
-      stickyHeight: 0
+      height: undefined
     }
   },
   mounted() {
     this.height = this.$el.getBoundingClientRect().height
     window.addEventListener('scroll', this.handleScroll)
+    window.addEventListener('resize', this.handleReize)
   },
   activated() {
     this.handleScroll()
   },
   destroyed() {
     window.removeEventListener('scroll', this.handleScroll)
+    window.removeEventListener('resize', this.handleReize)
   },
   methods: {
     sticky() {
@@ -70,6 +69,9 @@ export default {
         return
       }
       this.reset()
+    },
+    handleReize() {
+      this.width = this.$el.getBoundingClientRect().width + 'px'
     }
   }
 }
-- 
GitLab