layui/.svn/pristine/14/148a1f156c71c3b7f3ad6ac923fa0d2e099ceba2.svn-base
2022-12-09 16:41:41 +08:00

24 lines
511 B
Plaintext

import { defineComponent, VNodeTypes } from "vue";
import type { PropType } from "vue";
export type RenderFunc = (props: Record<string, unknown>) => VNodeTypes;
export default defineComponent({
name: "RenderFunction",
props: {
renderFunc: {
type: Function as PropType<RenderFunc>,
default: null,
},
},
setup(props, ctx) {
return () => {
if (typeof props.renderFunc !== "function") {
return null;
}
return props.renderFunc(ctx.attrs);
};
},
});