Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit ced7ee6

Browse files
zhiyuanzmjsxzz
andauthored
feat(compiler-vapor): support v-slots expression for jsx-vapor (#271)
Co-authored-by: 三咲智子 Kevin Deng <[email protected]>
1 parent 1094b05 commit ced7ee6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/compiler-vapor/src/generators/component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ function genRawSlots(slots: IRSlots[], context: CodegenContext) {
163163
...slots.map(slot =>
164164
slot.slotType === IRSlotType.STATIC
165165
? genStaticSlots(slot, context)
166-
: genDynamicSlot(slot, context, true),
166+
: slot.slotType === IRSlotType.EXPRESSION
167+
? slot.slots.content
168+
: genDynamicSlot(slot, context, true),
167169
),
168170
)
169171
}

packages/compiler-vapor/src/ir/component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export enum IRSlotType {
3636
DYNAMIC,
3737
LOOP,
3838
CONDITIONAL,
39+
EXPRESSION, // JSX only
3940
}
4041
export type IRSlotsStatic = {
4142
slotType: IRSlotType.STATIC
@@ -58,9 +59,13 @@ export interface IRSlotDynamicConditional {
5859
positive: IRSlotDynamicBasic
5960
negative?: IRSlotDynamicBasic | IRSlotDynamicConditional
6061
}
62+
export interface IRSlotsExpression {
63+
slotType: IRSlotType.EXPRESSION
64+
slots: SimpleExpressionNode
65+
}
6166

6267
export type IRSlotDynamic =
6368
| IRSlotDynamicBasic
6469
| IRSlotDynamicLoop
6570
| IRSlotDynamicConditional
66-
export type IRSlots = IRSlotsStatic | IRSlotDynamic
71+
export type IRSlots = IRSlotsStatic | IRSlotDynamic | IRSlotsExpression

0 commit comments

Comments
 (0)