fix(nuxt3): allow attrs to be included in head tags (#1959)

This commit is contained in:
Daniel Roe 2021-11-16 16:10:03 +00:00 committed by GitHub
parent 6d94158e95
commit 49179d2d8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@ const removeUndefinedProps = (props: Props) =>
Object.fromEntries(Object.entries(props).filter(([_key, value]) => value !== undefined))
const setupForUseMeta = (metaFactory: (props: Props, ctx: SetupContext) => Record<string, any>, renderChild?: boolean) => (props: Props, ctx: SetupContext) => {
useMeta(() => metaFactory(removeUndefinedProps(props), ctx))
useMeta(() => metaFactory({ ...removeUndefinedProps(props), ...ctx.attrs }, ctx))
return () => renderChild ? ctx.slots.default?.() : null
}