fix: 取消固定
This commit is contained in:
parent
581b8533f4
commit
2c6c56a45b
@ -121,30 +121,8 @@ const handleSelect = (payload) => {
|
||||
|
||||
}
|
||||
|
||||
const targetRef = ref(null)
|
||||
const isFixed = ref(false)
|
||||
|
||||
const handleScroll = () => {
|
||||
if (!targetRef.value) return
|
||||
|
||||
const rect = targetRef.value.$el
|
||||
? targetRef.value.$el.getBoundingClientRect()
|
||||
: targetRef.value.getBoundingClientRect()
|
||||
|
||||
isFixed.value = rect.top <= -140
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await handleQuery()
|
||||
})
|
||||
|
||||
watch(targetRef, (el) => {
|
||||
if (!el) return
|
||||
window.addEventListener('scroll', handleScroll)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('scroll', handleScroll)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user