From d8815237f542007e5f5b818a296cf6830f9ba42a Mon Sep 17 00:00:00 2001 From: roymondchen Date: Tue, 10 Dec 2024 16:05:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(core):=20devtools=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=9D=97=E5=87=BD=E6=95=B0=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E6=B2=A1=E6=9C=89name=EF=BC=8C=E5=AF=BC=E8=87=B4=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/DevtoolApi.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/src/DevtoolApi.ts b/packages/core/src/DevtoolApi.ts index 9abed2b8..3d919fb3 100644 --- a/packages/core/src/DevtoolApi.ts +++ b/packages/core/src/DevtoolApi.ts @@ -106,12 +106,14 @@ export default class DevToolApi { } const newCode = cloneDeep(code); + // eslint-disable-next-line prefer-const + let fuc = value; if (path === 'content' && typeof value === 'string' && (value.includes('function') || value.includes('=>'))) { // eslint-disable-next-line no-eval - value = eval(value); + eval(`fuc = ${value})`); } - setValueByKeyPath(path, value, newCode); + setValueByKeyPath(path, fuc, newCode); codeBlocks[codeId] = newCode; }