diff --git a/src/hooks/core/useRefs.ts b/src/hooks/core/useRefs.ts index ec380993..79c280f9 100644 --- a/src/hooks/core/useRefs.ts +++ b/src/hooks/core/useRefs.ts @@ -1,16 +1,20 @@ import type { Ref } from 'vue' import { onBeforeUpdate, ref } from 'vue' -export function useRefs(): [Ref, (index: number) => (el: HTMLElement) => void] { - const refs = ref([]) as Ref +function useRefs(): { refs: Ref; setRefs: (index: number) => (el: T) => void } { + const refs = ref([]) as Ref onBeforeUpdate(() => { refs.value = [] }) - const setRefs = (index: number) => (el: HTMLElement) => { + const setRefs = (index: number) => (el: T) => { refs.value[index] = el } - return [refs, setRefs] + return { + refs, + setRefs, + } } +export { useRefs }