From 4a69c9e665b6090300f13ff679f4e796b7d0ffd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <126167116+caodachen@users.noreply.github.com> Date: Wed, 1 Apr 2026 10:30:54 +0800 Subject: [PATCH] perf: replace `onUnMounted` to `tryOnScopeDispose` (#7747) * perf: replace `onUnMounted` to `tryOnScopeDispose` * perf: replace `onUnMounted` to `tryOnScopeDispose` --- packages/effects/hooks/src/use-hover-toggle.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/effects/hooks/src/use-hover-toggle.ts b/packages/effects/hooks/src/use-hover-toggle.ts index 0bed41dd3..e0280daa3 100644 --- a/packages/effects/hooks/src/use-hover-toggle.ts +++ b/packages/effects/hooks/src/use-hover-toggle.ts @@ -2,11 +2,11 @@ import type { Arrayable, MaybeElementRef } from '@vueuse/core'; import type { Ref } from 'vue'; -import { computed, effectScope, onUnmounted, ref, unref, watch } from 'vue'; +import { computed, effectScope, ref, unref, watch } from 'vue'; import { isFunction } from '@vben/utils'; -import { useElementHover } from '@vueuse/core'; +import { tryOnScopeDispose, useElementHover } from '@vueuse/core'; interface HoverDelayOptions { /** 鼠标进入延迟时间 */ @@ -151,7 +151,7 @@ export function useHoverToggle( }, }; - onUnmounted(() => { + tryOnScopeDispose(() => { clearTimers(); // 停止监听器 stopWatcher();