fix(nuxt): remove internal <FragmentWrapper> (#20607)

This commit is contained in:
Daniel Roe 2023-05-01 12:56:30 +01:00 committed by GitHub
parent c9c51cb3d8
commit 2c55bb6f84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,22 +1,16 @@
import { defineComponent, h } from 'vue' import { h } from 'vue'
import type { Component } from 'vue' import type { Component } from 'vue'
// eslint-disable-next-line // eslint-disable-next-line
import { isString, isPromise, isArray } from '@vue/shared' import { isString, isPromise, isArray } from '@vue/shared'
const Fragment = defineComponent({
name: 'FragmentWrapper',
setup (_props, { slots }) {
return () => slots.default?.()
}
})
/** /**
* Internal utility * Internal utility
* *
* @private * @private
*/ */
export const _wrapIf = (component: Component, props: any, slots: any) => { export const _wrapIf = (component: Component, props: any, slots: any) => {
return { default: () => props ? h(component, props === true ? {} : props, slots) : h(Fragment, {}, slots) } props = props === true ? {} : props
return { default: () => props ? h(component, props, slots) : slots.default?.() }
} }
// eslint-disable-next-line no-use-before-define // eslint-disable-next-line no-use-before-define