fix: 修复一些问题

This commit is contained in:
XiaoDaiGua-Ray 2025-06-26 17:48:07 +08:00
parent c28c353f7d
commit 34c20d4be7

View File

@ -41,15 +41,16 @@ const throttleDirective: CustomDirectiveFC<
throttleFunction = throttle(func, wait, Object.assign({}, options))
useEventListener(el, trigger, throttleFunction)
cleanup = useEventListener(el, trigger, throttleFunction)
},
beforeUnmount: () => {
if (throttleFunction) {
throttleFunction.cancel()
cleanup?.()
}
throttleFunction = null
cleanup?.()
},
}
}