diff --git a/src/runtime/utils/link.ts b/src/runtime/utils/link.ts index 263c8ca9..85b0591d 100644 --- a/src/runtime/utils/link.ts +++ b/src/runtime/utils/link.ts @@ -1,6 +1,20 @@ import { reactivePick } from '@vueuse/core' import type { LinkProps } from '../types' -export function pickLinkProps(link: LinkProps & { ariaLabel?: string, title?: string }) { - return reactivePick(link, 'active', 'activeClass', 'ariaCurrentValue', 'ariaLabel', 'as', 'disabled', 'exact', 'exactActiveClass', 'exactHash', 'exactQuery', 'external', 'href', 'inactiveClass', 'noPrefetch', 'noRel', 'prefetch', 'prefetchedClass', 'rel', 'replace', 'target', 'to', 'type', 'title') +export function pickLinkProps(link: LinkProps & { [key: string]: any }) { + const keys = Object.keys(link) + + const ariaKeys = keys.filter(key => key.startsWith('aria-')) + const dataKeys = keys.filter(key => key.startsWith('data-')) + + const propsToInclude = [ + 'active', 'activeClass', 'ariaCurrentValue', 'as', 'disabled', + 'exact', 'exactActiveClass', 'exactHash', 'exactQuery', 'external', + 'href', 'inactiveClass', 'noPrefetch', 'noRel', 'prefetch', + 'prefetchedClass', 'rel', 'replace', 'target', 'to', 'type', 'title', + ...ariaKeys, + ...dataKeys + ] + + return reactivePick(link, ...propsToInclude) }