]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-core): ensure slot compiler marker writable (#10825)
authoredison <daiwei521@126.com>
Mon, 29 Apr 2024 03:47:40 +0000 (11:47 +0800)
committerGitHub <noreply@github.com>
Mon, 29 Apr 2024 03:47:40 +0000 (11:47 +0800)
close #10818

packages/runtime-core/src/componentSlots.ts
packages/shared/src/general.ts

index aeba4d5c6b0a0374978a90dd7fc89724cb48e3f5..2bc3466c459231b0098ae53f284ec1d86d2d138c 100644 (file)
@@ -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)
     }
index 47ab0229255e9431b3e51f877457bc02439bf295..fb884695d336c6d91b590199956a91aeda918287 100644 (file)
@@ -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,
   })
 }