2022-08-12 17:47:58 +00:00
|
|
|
import { defineComponent, h } from 'vue'
|
2022-03-14 10:47:24 +00:00
|
|
|
import type { Component } from 'vue'
|
|
|
|
|
2022-08-12 17:47:58 +00:00
|
|
|
const Fragment = defineComponent({
|
2023-01-14 01:27:38 +00:00
|
|
|
name: 'FragmentWrapper',
|
2022-03-14 10:47:24 +00:00
|
|
|
setup (_props, { slots }) {
|
2022-05-06 10:52:08 +00:00
|
|
|
return () => slots.default?.()
|
2022-03-14 10:47:24 +00:00
|
|
|
}
|
2022-08-12 17:47:58 +00:00
|
|
|
})
|
2022-03-14 10:47:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal utility
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
*/
|
|
|
|
export const _wrapIf = (component: Component, props: any, slots: any) => {
|
|
|
|
return { default: () => props ? h(component, props === true ? {} : props, slots) : h(Fragment, {}, slots) }
|
|
|
|
}
|