Skip to content

Commit

Permalink
fix(slots): filter out compiler marker from resolved slots
Browse files Browse the repository at this point in the history
fix #1451
  • Loading branch information
yyx990803 committed Jun 26, 2020
1 parent 7777473 commit 70ea76a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/runtime-core/src/componentSlots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ export const initSlots = (
) => {
if (instance.vnode.shapeFlag & ShapeFlags.SLOTS_CHILDREN) {
if ((children as RawSlots)._ === 1) {
instance.slots = children as InternalSlots
const slots: InternalSlots = (instance.slots = {})
for (const key in children as RawSlots) {
if (key !== '_') slots[key] = (children as Slots)[key]
}
} else {
normalizeObjectSlots(children as RawSlots, (instance.slots = {}))
}
Expand All @@ -128,7 +131,9 @@ export const updateSlots = (
if (__DEV__ && isHmrUpdating) {
// Parent was HMR updated so slot content may have changed.
// force update slots and mark instance for hmr as well
extend(slots, children as Slots)
for (const key in children as RawSlots) {
if (key !== '_') slots[key] = (children as Slots)[key]
}
} else if (
// bail on dynamic slots (v-if, v-for, reference of scope variables)
!(vnode.patchFlag & PatchFlags.DYNAMIC_SLOTS)
Expand Down

0 comments on commit 70ea76a

Please sign in to comment.