Skip to content
Snippets Groups Projects
Commit cef1f119 authored by Pan's avatar Pan
Browse files

fix:fixed sticky component bug in keep-alive

parent 443c7aed
No related branches found
No related tags found
No related merge requests found
......@@ -33,9 +33,18 @@ export default {
height: undefined,
child: null,
stickyHeight: 0
}
},
mounted() {
this.height = this.$el.getBoundingClientRect().height
window.addEventListener('scroll', this.handleScroll)
},
activated() {
this.handleScroll()
},
destroyed() {
window.removeEventListener('scroll', this.handleScroll)
},
methods: {
sticky() {
if (this.active) {
......@@ -62,13 +71,6 @@ export default {
}
this.reset()
}
},
mounted() {
this.height = this.$el.getBoundingClientRect().height
window.addEventListener('scroll', this.handleScroll)
},
destroyed() {
window.removeEventListener('scroll', this.handleScroll)
}
}
</script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment