]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
perf( runtime-core): use `apply` to avoid spreading. (#5985)
authorzhangenming <282126346@qq.com>
Mon, 19 Aug 2024 08:25:01 +0000 (16:25 +0800)
committerGitHub <noreply@github.com>
Mon, 19 Aug 2024 08:25:01 +0000 (16:25 +0800)
packages/runtime-core/src/compat/global.ts
packages/runtime-core/src/compat/instanceEventEmitter.ts

index 5356ce790d7233d6e4828d5b868caf816e348b8f..edc57436a56a8071d3b0faa277dee1bcb68d3f49 100644 (file)
@@ -622,11 +622,9 @@ function defineReactive(obj: any, key: string, val: any) {
   if (isObject(val) && !isReactive(val) && !patched.has(val)) {
     const reactiveVal = reactive(val)
     if (isArray(val)) {
-      methodsToPatch.forEach(m => {
-        // @ts-expect-error
+      methodsToPatch.forEach((m: any) => {
         val[m] = (...args: any[]) => {
-          // @ts-expect-error
-          Array.prototype[m].call(reactiveVal, ...args)
+          Array.prototype[m].apply(reactiveVal, args)
         }
       })
     } else {
index 630df1cfe7f245b9856a1ad2b4556ceb5761f0b7..cdf2d798864397a03e7d4da4f04fa4b0da01bc28 100644 (file)
@@ -53,7 +53,7 @@ export function once(
 ): ComponentPublicInstance | null {
   const wrapped = (...args: any[]) => {
     off(instance, event, wrapped)
-    fn.call(instance.proxy, ...args)
+    fn.apply(instance.proxy, args)
   }
   wrapped.fn = fn
   on(instance, event, wrapped)