fix[Sticky]: fixed bug in resize #724
This commit is contained in:
parent
03e5f762b3
commit
0375542009
1 changed files with 7 additions and 2 deletions
|
@ -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,8 +74,10 @@ export default {
|
|||
this.reset()
|
||||
},
|
||||
handleReize() {
|
||||
if (this.isSticky) {
|
||||
this.width = this.$el.getBoundingClientRect().width + 'px'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue