Skip to content

Commit 0375542

Browse files
committed
fix[Sticky]: fixed bug in resize PanJiaChen#724
1 parent 03e5f76 commit 0375542

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/components/Sticky/index.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export default {
2929
active: false,
3030
position: '',
3131
width: undefined,
32-
height: undefined
32+
height: undefined,
33+
isSticky: false
3334
}
3435
},
3536
mounted() {
@@ -52,6 +53,7 @@ export default {
5253
this.position = 'fixed'
5354
this.active = true
5455
this.width = this.width + 'px'
56+
this.isSticky = true
5557
},
5658
reset() {
5759
if (!this.active) {
@@ -60,6 +62,7 @@ export default {
6062
this.position = ''
6163
this.width = 'auto'
6264
this.active = false
65+
this.isSticky = false
6366
},
6467
handleScroll() {
6568
this.width = this.$el.getBoundingClientRect().width
@@ -71,7 +74,9 @@ export default {
7174
this.reset()
7275
},
7376
handleReize() {
74-
this.width = this.$el.getBoundingClientRect().width + 'px'
77+
if (this.isSticky) {
78+
this.width = this.$el.getBoundingClientRect().width + 'px'
79+
}
7580
}
7681
}
7782
}

0 commit comments

Comments
 (0)