Skip to content

Commit 3357ff4

Browse files
committed
fix(slots): fix conditional slot
fix #787
1 parent 5d952cc commit 3357ff4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/runtime-core/src/helpers/createSlots.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ interface CompiledSlotDescriptor {
88

99
export function createSlots(
1010
slots: Record<string, Slot>,
11-
dynamicSlots: (CompiledSlotDescriptor | CompiledSlotDescriptor[])[]
11+
dynamicSlots: (
12+
| CompiledSlotDescriptor
13+
| CompiledSlotDescriptor[]
14+
| undefined)[]
1215
): Record<string, Slot> {
1316
for (let i = 0; i < dynamicSlots.length; i++) {
1417
const slot = dynamicSlots[i]
@@ -17,7 +20,7 @@ export function createSlots(
1720
for (let j = 0; j < slot.length; j++) {
1821
slots[slot[j].name] = slot[j].fn
1922
}
20-
} else {
23+
} else if (slot) {
2124
// conditional single slot generated by <template v-if="..." #foo>
2225
slots[slot.name] = slot.fn
2326
}

0 commit comments

Comments
 (0)