Skip to content

Commit

Permalink
fix(slots): make compiled slot marker non-enumerable
Browse files Browse the repository at this point in the history
fix #1470
  • Loading branch information
yyx990803 committed Jun 30, 2020
1 parent 3a7690e commit 062835d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/runtime-core/src/componentSlots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,9 @@ export const initSlots = (
) => {
if (instance.vnode.shapeFlag & ShapeFlags.SLOTS_CHILDREN) {
if ((children as RawSlots)._ === 1) {
const slots: InternalSlots = (instance.slots = {})
for (const key in children as RawSlots) {
if (key !== '_') slots[key] = (children as Slots)[key]
}
instance.slots = children as InternalSlots
// make compiler marker non-enumerable
def(children as InternalSlots, '_', 1)
} else {
normalizeObjectSlots(children as RawSlots, (instance.slots = {}))
}
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export const invokeArrayFns = (fns: Function[], arg?: any) => {
export const def = (obj: object, key: string | symbol, value: any) => {
Object.defineProperty(obj, key, {
configurable: true,
enumerable: false,
value
})
}
Expand Down

0 comments on commit 062835d

Please sign in to comment.