diff --git a/packages/runtime-core/src/componentSlots.ts b/packages/runtime-core/src/componentSlots.ts index aeba4d5c6b0..2bc3466c459 100644 --- a/packages/runtime-core/src/componentSlots.ts +++ b/packages/runtime-core/src/componentSlots.ts @@ -171,7 +171,7 @@ export const initSlots = ( if (type) { extend(slots, children as InternalSlots) // make compiler marker non-enumerable - def(slots, '_', type) + def(slots, '_', type, true) } else { normalizeObjectSlots(children as RawSlots, slots, instance) } diff --git a/packages/shared/src/general.ts b/packages/shared/src/general.ts index 47ab0229255..fb884695d33 100644 --- a/packages/shared/src/general.ts +++ b/packages/shared/src/general.ts @@ -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, { configurable: true, enumerable: false, + writable, value, }) }