feat: add utility to convert functional component to basic component vnode
This commit is contained in:
parent
afd3ad9102
commit
68fc41db1c
|
|
@ -1,7 +1,8 @@
|
||||||
import type { ClassValue } from 'clsx'
|
import type { ClassValue } from 'clsx'
|
||||||
import { clsx } from 'clsx'
|
import { clsx } from 'clsx'
|
||||||
import { twMerge } from 'tailwind-merge'
|
import { twMerge } from 'tailwind-merge'
|
||||||
import { camelize, getCurrentInstance, toHandlerKey } from 'vue'
|
import type { FunctionalComponent } from 'vue'
|
||||||
|
import { camelize, defineComponent, getCurrentInstance, h, toHandlerKey } from 'vue'
|
||||||
|
|
||||||
export type ParseEmits<T extends Record<string, any>> = {
|
export type ParseEmits<T extends Record<string, any>> = {
|
||||||
[K in keyof T]: (...args: T[K]) => void;
|
[K in keyof T]: (...args: T[K]) => void;
|
||||||
|
|
@ -31,3 +32,9 @@ export function useEmitAsProps<Name extends string>(
|
||||||
})
|
})
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function convertToVNode(component: FunctionalComponent) {
|
||||||
|
return defineComponent({
|
||||||
|
setup() { return () => h(component) },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user