Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(compiler-vapor): support v-slots expression for jsx-vapor #271

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/compiler-vapor/src/generators/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ function genRawSlots(slots: IRSlots[], context: CodegenContext) {
...slots.map(slot =>
slot.slotType === IRSlotType.STATIC
? genStaticSlots(slot, context)
: genDynamicSlot(slot, context, true),
: slot.slotType === IRSlotType.EXPRESSION
? slot.slots.content
: genDynamicSlot(slot, context, true),
),
)
}
Expand Down
7 changes: 6 additions & 1 deletion packages/compiler-vapor/src/ir/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export enum IRSlotType {
DYNAMIC,
LOOP,
CONDITIONAL,
EXPRESSION, // JSX only
}
export type IRSlotsStatic = {
slotType: IRSlotType.STATIC
Expand All @@ -58,9 +59,13 @@ export interface IRSlotDynamicConditional {
positive: IRSlotDynamicBasic
negative?: IRSlotDynamicBasic | IRSlotDynamicConditional
}
export interface IRSlotsExpression {
slotType: IRSlotType.EXPRESSION
slots: SimpleExpressionNode
}

export type IRSlotDynamic =
| IRSlotDynamicBasic
| IRSlotDynamicLoop
| IRSlotDynamicConditional
export type IRSlots = IRSlotsStatic | IRSlotDynamic
export type IRSlots = IRSlotsStatic | IRSlotDynamic | IRSlotsExpression