fix: 取消固定

This commit is contained in:
lonewolfyx 2026-03-05 16:22:20 +08:00
parent 581b8533f4
commit 2c6c56a45b

View File

@ -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>