From def6c25eeeecb75bb9efe3a3b8483b7bfaf221bc Mon Sep 17 00:00:00 2001 From: Shehab Rahal Date: Tue, 28 Nov 2023 19:44:43 +0800 Subject: [PATCH] refactor: primitive use only slots --- packages/core/primitive/src/primitive.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/core/primitive/src/primitive.ts b/packages/core/primitive/src/primitive.ts index 55f2e7c32..7b6a660c4 100644 --- a/packages/core/primitive/src/primitive.ts +++ b/packages/core/primitive/src/primitive.ts @@ -27,19 +27,18 @@ const Primitive = NODES.reduce((primitive, node) => { onMounted(() => { (window as any)[Symbol.for('oku-ui')] = true }) + const Tag: any = asChild.value ? OkuSlot : node return () => { const mergedProps = mergeProps(attrs, primitiveProps) - return createVNode(Tag, { ...mergedProps, ref: composedRefs }, slots.default?.()) + + return createVNode(Tag, { ...mergedProps, ref: composedRefs }, slots) } }, }) - const NodeProps = selectNode as typeof selectNode - & (new () => { - $props: OkuElement - }) + const NodeProps = selectNode as typeof selectNode & (new () => { $props: OkuElement }) return { ...primitive, [node]: NodeProps } }, {} as Primitives)