mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-16 19:04:48 +00:00
16 lines
506 B
TypeScript
16 lines
506 B
TypeScript
|
import { Component, KeepAlive, h } from 'vue'
|
||
|
|
||
|
const Fragment = {
|
||
|
setup (_props, { slots }) {
|
||
|
return () => slots.default()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export const wrapIf = (component: Component, props: any, slots: any) => {
|
||
|
return { default: () => props ? h(component, props === true ? {} : props, slots) : h(Fragment, {}, slots) }
|
||
|
}
|
||
|
|
||
|
export const wrapInKeepAlive = (props: any, children: any) => {
|
||
|
return { default: () => process.client && props ? h(KeepAlive, props === true ? {} : props, children) : children }
|
||
|
}
|