From 1c8a3f3260a2787f4ec2940894bea61cebbdfdf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BF=B7=E6=B8=A1?= Date: Thu, 20 Jul 2023 16:13:33 +0800 Subject: [PATCH] fix(runtime-core): fix 'Maximum call stack size exceeded' caused by native event attrs --- packages/runtime-core/src/errorHandling.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/runtime-core/src/errorHandling.ts b/packages/runtime-core/src/errorHandling.ts index afbd226c4c6..7660804ae2e 100644 --- a/packages/runtime-core/src/errorHandling.ts +++ b/packages/runtime-core/src/errorHandling.ts @@ -1,7 +1,7 @@ import { VNode } from './vnode' import { ComponentInternalInstance } from './component' import { warn, pushWarningContext, popWarningContext } from './warning' -import { isPromise, isFunction } from '@vue/shared' +import { isPromise, isFunction, isString } from '@vue/shared' import { LifecycleHooks } from './enums' // contexts where user provided function may be executed, in addition to @@ -81,6 +81,9 @@ export function callWithAsyncErrorHandling( type: ErrorTypes, args?: unknown[] ): any[] { + if (isString(fn)) { + fn = new Function(fn) + } if (isFunction(fn)) { const res = callWithErrorHandling(fn, instance, type, args) if (res && isPromise(res)) {