mirror of https://github.com/vuejs/core.git
perf( runtime-core): use `apply` to avoid spreading. (#5985)
This commit is contained in:
parent
98b83e86d1
commit
bb6babca8f
|
@ -622,11 +622,9 @@ function defineReactive(obj: any, key: string, val: any) {
|
||||||
if (isObject(val) && !isReactive(val) && !patched.has(val)) {
|
if (isObject(val) && !isReactive(val) && !patched.has(val)) {
|
||||||
const reactiveVal = reactive(val)
|
const reactiveVal = reactive(val)
|
||||||
if (isArray(val)) {
|
if (isArray(val)) {
|
||||||
methodsToPatch.forEach(m => {
|
methodsToPatch.forEach((m: any) => {
|
||||||
// @ts-expect-error
|
|
||||||
val[m] = (...args: any[]) => {
|
val[m] = (...args: any[]) => {
|
||||||
// @ts-expect-error
|
Array.prototype[m].apply(reactiveVal, args)
|
||||||
Array.prototype[m].call(reactiveVal, ...args)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -53,7 +53,7 @@ export function once(
|
||||||
): ComponentPublicInstance | null {
|
): ComponentPublicInstance | null {
|
||||||
const wrapped = (...args: any[]) => {
|
const wrapped = (...args: any[]) => {
|
||||||
off(instance, event, wrapped)
|
off(instance, event, wrapped)
|
||||||
fn.call(instance.proxy, ...args)
|
fn.apply(instance.proxy, args)
|
||||||
}
|
}
|
||||||
wrapped.fn = fn
|
wrapped.fn = fn
|
||||||
on(instance, event, wrapped)
|
on(instance, event, wrapped)
|
||||||
|
|
Loading…
Reference in New Issue