fix(core): devtools更新代码块函数可能没有name,导致失败

This commit is contained in:
roymondchen 2024-12-10 16:05:25 +08:00
parent 3cae4fbc1c
commit d8815237f5

View File

@ -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;
}