mirror of https://github.com/vuejs/core.git
fix(runtime-core): ensure slot compiler marker writable (#10825)
close #10818
This commit is contained in:
parent
47453f102e
commit
9c2de6244c
|
@ -171,7 +171,7 @@ export const initSlots = (
|
||||||
if (type) {
|
if (type) {
|
||||||
extend(slots, children as InternalSlots)
|
extend(slots, children as InternalSlots)
|
||||||
// make compiler marker non-enumerable
|
// make compiler marker non-enumerable
|
||||||
def(slots, '_', type)
|
def(slots, '_', type, true)
|
||||||
} else {
|
} else {
|
||||||
normalizeObjectSlots(children as RawSlots, slots, instance)
|
normalizeObjectSlots(children as RawSlots, slots, instance)
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,10 +139,16 @@ export const invokeArrayFns = (fns: Function[], arg?: any) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const def = (obj: object, key: string | symbol, value: any) => {
|
export const def = (
|
||||||
|
obj: object,
|
||||||
|
key: string | symbol,
|
||||||
|
value: any,
|
||||||
|
writable = false,
|
||||||
|
) => {
|
||||||
Object.defineProperty(obj, key, {
|
Object.defineProperty(obj, key, {
|
||||||
configurable: true,
|
configurable: true,
|
||||||
enumerable: false,
|
enumerable: false,
|
||||||
|
writable,
|
||||||
value,
|
value,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue