fix[Sticky]: fixed bug in resize #721
This commit is contained in:
parent
bd0227feed
commit
03e5f762b3
|
@ -28,22 +28,21 @@ export default {
|
||||||
return {
|
return {
|
||||||
active: false,
|
active: false,
|
||||||
position: '',
|
position: '',
|
||||||
currentTop: '',
|
|
||||||
width: undefined,
|
width: undefined,
|
||||||
height: undefined,
|
height: undefined
|
||||||
child: null,
|
|
||||||
stickyHeight: 0
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.height = this.$el.getBoundingClientRect().height
|
this.height = this.$el.getBoundingClientRect().height
|
||||||
window.addEventListener('scroll', this.handleScroll)
|
window.addEventListener('scroll', this.handleScroll)
|
||||||
|
window.addEventListener('resize', this.handleReize)
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
this.handleScroll()
|
this.handleScroll()
|
||||||
},
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
window.removeEventListener('scroll', this.handleScroll)
|
window.removeEventListener('scroll', this.handleScroll)
|
||||||
|
window.removeEventListener('resize', this.handleReize)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
sticky() {
|
sticky() {
|
||||||
|
@ -70,6 +69,9 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.reset()
|
this.reset()
|
||||||
|
},
|
||||||
|
handleReize() {
|
||||||
|
this.width = this.$el.getBoundingClientRect().width + 'px'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue