Browse Source
perf: replace `onUnMounted` to `tryOnScopeDispose` (#7747)
* perf: replace `onUnMounted` to `tryOnScopeDispose`
* perf: replace `onUnMounted` to `tryOnScopeDispose`
pull/7755/head
橙子
6 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
3 additions and
3 deletions
-
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 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 { isFunction } from '@vben/utils'; |
|
|
|
|
|
|
|
|
import { useElementHover } from '@vueuse/core'; |
|
|
import { tryOnScopeDispose, useElementHover } from '@vueuse/core'; |
|
|
|
|
|
|
|
|
interface HoverDelayOptions { |
|
|
interface HoverDelayOptions { |
|
|
/** 鼠标进入延迟时间 */ |
|
|
/** 鼠标进入延迟时间 */ |
|
|
@ -151,7 +151,7 @@ export function useHoverToggle( |
|
|
}, |
|
|
}, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
onUnmounted(() => { |
|
|
tryOnScopeDispose(() => { |
|
|
clearTimers(); |
|
|
clearTimers(); |
|
|
// 停止监听器
|
|
|
// 停止监听器
|
|
|
stopWatcher(); |
|
|
stopWatcher(); |
|
|
|