mirror of https://github.com/vuejs/core.git
feat(compiler-vapor): support v-slots expression for jsx-vapor (#271)
Co-authored-by: 三咲智子 Kevin Deng <sxzz@sxzz.moe>
This commit is contained in:
parent
1094b05259
commit
ced7ee684c
|
@ -163,7 +163,9 @@ function genRawSlots(slots: IRSlots[], context: CodegenContext) {
|
||||||
...slots.map(slot =>
|
...slots.map(slot =>
|
||||||
slot.slotType === IRSlotType.STATIC
|
slot.slotType === IRSlotType.STATIC
|
||||||
? genStaticSlots(slot, context)
|
? genStaticSlots(slot, context)
|
||||||
: genDynamicSlot(slot, context, true),
|
: slot.slotType === IRSlotType.EXPRESSION
|
||||||
|
? slot.slots.content
|
||||||
|
: genDynamicSlot(slot, context, true),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ export enum IRSlotType {
|
||||||
DYNAMIC,
|
DYNAMIC,
|
||||||
LOOP,
|
LOOP,
|
||||||
CONDITIONAL,
|
CONDITIONAL,
|
||||||
|
EXPRESSION, // JSX only
|
||||||
}
|
}
|
||||||
export type IRSlotsStatic = {
|
export type IRSlotsStatic = {
|
||||||
slotType: IRSlotType.STATIC
|
slotType: IRSlotType.STATIC
|
||||||
|
@ -58,9 +59,13 @@ export interface IRSlotDynamicConditional {
|
||||||
positive: IRSlotDynamicBasic
|
positive: IRSlotDynamicBasic
|
||||||
negative?: IRSlotDynamicBasic | IRSlotDynamicConditional
|
negative?: IRSlotDynamicBasic | IRSlotDynamicConditional
|
||||||
}
|
}
|
||||||
|
export interface IRSlotsExpression {
|
||||||
|
slotType: IRSlotType.EXPRESSION
|
||||||
|
slots: SimpleExpressionNode
|
||||||
|
}
|
||||||
|
|
||||||
export type IRSlotDynamic =
|
export type IRSlotDynamic =
|
||||||
| IRSlotDynamicBasic
|
| IRSlotDynamicBasic
|
||||||
| IRSlotDynamicLoop
|
| IRSlotDynamicLoop
|
||||||
| IRSlotDynamicConditional
|
| IRSlotDynamicConditional
|
||||||
export type IRSlots = IRSlotsStatic | IRSlotDynamic
|
export type IRSlots = IRSlotsStatic | IRSlotDynamic | IRSlotsExpression
|
||||||
|
|
Loading…
Reference in New Issue