fix:fixed sticky component bug in keep-alive
							parent
							
								
									443c7aed3c
								
							
						
					
					
						commit
						cef1f11931
					
				| 
						 | 
					@ -33,9 +33,18 @@ export default {
 | 
				
			||||||
      height: undefined,
 | 
					      height: undefined,
 | 
				
			||||||
      child: null,
 | 
					      child: null,
 | 
				
			||||||
      stickyHeight: 0
 | 
					      stickyHeight: 0
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					  mounted() {
 | 
				
			||||||
 | 
					    this.height = this.$el.getBoundingClientRect().height
 | 
				
			||||||
 | 
					    window.addEventListener('scroll', this.handleScroll)
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  activated() {
 | 
				
			||||||
 | 
					    this.handleScroll()
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  destroyed() {
 | 
				
			||||||
 | 
					    window.removeEventListener('scroll', this.handleScroll)
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
  methods: {
 | 
					  methods: {
 | 
				
			||||||
    sticky() {
 | 
					    sticky() {
 | 
				
			||||||
      if (this.active) {
 | 
					      if (this.active) {
 | 
				
			||||||
| 
						 | 
					@ -62,13 +71,6 @@ export default {
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      this.reset()
 | 
					      this.reset()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  mounted() {
 | 
					 | 
				
			||||||
    this.height = this.$el.getBoundingClientRect().height
 | 
					 | 
				
			||||||
    window.addEventListener('scroll', this.handleScroll)
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  destroyed() {
 | 
					 | 
				
			||||||
    window.removeEventListener('scroll', this.handleScroll)
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue