Skip to content

Commit

Permalink
fix(slots): fix conditional slot
Browse files Browse the repository at this point in the history
fix #787
  • Loading branch information
yyx990803 committed Feb 27, 2020
1 parent 5d952cc commit 3357ff4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/runtime-core/src/helpers/createSlots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ interface CompiledSlotDescriptor {

export function createSlots(
slots: Record<string, Slot>,
dynamicSlots: (CompiledSlotDescriptor | CompiledSlotDescriptor[])[]
dynamicSlots: (
| CompiledSlotDescriptor
| CompiledSlotDescriptor[]
| undefined)[]
): Record<string, Slot> {
for (let i = 0; i < dynamicSlots.length; i++) {
const slot = dynamicSlots[i]
Expand All @@ -17,7 +20,7 @@ export function createSlots(
for (let j = 0; j < slot.length; j++) {
slots[slot[j].name] = slot[j].fn
}
} else {
} else if (slot) {
// conditional single slot generated by <template v-if="..." #foo>
slots[slot.name] = slot.fn
}
Expand Down

0 comments on commit 3357ff4

Please sign in to comment.