mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
fix(components): [affix] positioning under KeepAlive cache (#23549)
* fix(components): [affix] positioning under KeepAlive cache * Update packages/components/affix/src/affix.vue Co-authored-by: rzzf <cszhjh@gmail.com> --------- Co-authored-by: rzzf <cszhjh@gmail.com>
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
import {
|
||||
computed,
|
||||
nextTick,
|
||||
onActivated,
|
||||
onDeactivated,
|
||||
onMounted,
|
||||
ref,
|
||||
shallowRef,
|
||||
@@ -158,6 +160,14 @@ onMounted(() => {
|
||||
updateRoot()
|
||||
})
|
||||
|
||||
onActivated(() => {
|
||||
nextTick(updateRootRect)
|
||||
})
|
||||
|
||||
onDeactivated(() => {
|
||||
fixed.value = false
|
||||
})
|
||||
|
||||
useEventListener(scrollContainer, 'scroll', handleScroll)
|
||||
watchEffect(update)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user