From c3099aba0d684e9b6bffcd86821bc74aa580ac77 Mon Sep 17 00:00:00 2001 From: JEECG <445654970@qq.com> Date: Wed, 24 Jun 2026 11:00:01 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90issues/9699=E3=80=91JS=E5=A2=9E?= =?UTF-8?q?=E5=BC=BA=E5=86=99=E9=94=99=E4=BA=86=E4=B9=8B=E5=90=8E=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Form/src/jeecg/components/JCodeEditor.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/jeecgboot-vue3/src/components/Form/src/jeecg/components/JCodeEditor.vue b/jeecgboot-vue3/src/components/Form/src/jeecg/components/JCodeEditor.vue index 53d6c8ec3..f60685266 100644 --- a/jeecgboot-vue3/src/components/Form/src/jeecg/components/JCodeEditor.vue +++ b/jeecgboot-vue3/src/components/Form/src/jeecg/components/JCodeEditor.vue @@ -171,8 +171,15 @@ */ function setValue(value: string, trigger = true) { if (value && isJsonObjectString(value)) { - value = JSON.stringify(JSON.parse(value), null, 2); + // update-begin--author:liaozhiyang---date:20260617---for:【issues/9699】JS增强写错了之后页面报错 + // isJsonObjectString 仅判断首尾字符,无法保证合法 JSON;解析失败时保留原值,避免非 JSON 内容(如 JS 增强代码)打开时报错卡死 + try { + value = JSON.stringify(JSON.parse(value), null, 2); + } catch (e) { + // 非合法 JSON,按原文本展示 + } } + // update-end--author:liaozhiyang---date:20260617---for:【issues/9699】JS增强写错了之后页面报错 coder?.setValue(value ?? ''); innerValue = value; trigger && emitChange(innerValue);