fix(nuxt): allow passing extraneous attrs to meta components (#5071)

This commit is contained in:
Daniel Roe 2022-05-20 15:42:19 +01:00 committed by GitHub
parent d9b6c8a59b
commit a4a3cffb92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -61,6 +61,7 @@ const globalProps = {
// <script> // <script>
export const Script = defineComponent({ export const Script = defineComponent({
name: 'Script', name: 'Script',
inheritAttrs: false,
props: { props: {
...globalProps, ...globalProps,
async: Boolean, async: Boolean,
@ -88,6 +89,7 @@ export const Script = defineComponent({
// <link> // <link>
export const Link = defineComponent({ export const Link = defineComponent({
name: 'Link', name: 'Link',
inheritAttrs: false,
props: { props: {
...globalProps, ...globalProps,
as: String, as: String,
@ -121,6 +123,7 @@ export const Link = defineComponent({
// <base> // <base>
export const Base = defineComponent({ export const Base = defineComponent({
name: 'Base', name: 'Base',
inheritAttrs: false,
props: { props: {
...globalProps, ...globalProps,
href: String, href: String,
@ -134,6 +137,7 @@ export const Base = defineComponent({
// <title> // <title>
export const Title = defineComponent({ export const Title = defineComponent({
name: 'Title', name: 'Title',
inheritAttrs: false,
setup: setupForUseMeta((_, { slots }) => { setup: setupForUseMeta((_, { slots }) => {
const title = slots.default?.()?.[0]?.children || null const title = slots.default?.()?.[0]?.children || null
if (process.dev && title && typeof title !== 'string') { if (process.dev && title && typeof title !== 'string') {
@ -148,6 +152,7 @@ export const Title = defineComponent({
// <meta> // <meta>
export const Meta = defineComponent({ export const Meta = defineComponent({
name: 'Meta', name: 'Meta',
inheritAttrs: false,
props: { props: {
...globalProps, ...globalProps,
charset: String, charset: String,
@ -163,6 +168,7 @@ export const Meta = defineComponent({
// <style> // <style>
export const Style = defineComponent({ export const Style = defineComponent({
name: 'Style', name: 'Style',
inheritAttrs: false,
props: { props: {
...globalProps, ...globalProps,
type: String, type: String,
@ -193,12 +199,14 @@ export const Style = defineComponent({
// <head> // <head>
export const Head = defineComponent({ export const Head = defineComponent({
name: 'Head', name: 'Head',
inheritAttrs: false,
setup: (_props, ctx) => () => ctx.slots.default?.() setup: (_props, ctx) => () => ctx.slots.default?.()
}) })
// <html> // <html>
export const Html = defineComponent({ export const Html = defineComponent({
name: 'Html', name: 'Html',
inheritAttrs: false,
props: { props: {
...globalProps, ...globalProps,
manifest: String, manifest: String,
@ -211,6 +219,7 @@ export const Html = defineComponent({
// <body> // <body>
export const Body = defineComponent({ export const Body = defineComponent({
name: 'Body', name: 'Body',
inheritAttrs: false,
props: globalProps, props: globalProps,
setup: setupForUseMeta(bodyAttrs => ({ bodyAttrs }), true) setup: setupForUseMeta(bodyAttrs => ({ bodyAttrs }), true)
}) })