From a4af74751f75679f98bc2c3d5c1c84a7d5e968ca Mon Sep 17 00:00:00 2001 From: MerCry Date: Thu, 26 Feb 2026 12:17:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DConfigForm=E7=BB=84?= =?UTF-8?q?=E4=BB=B6watch=E6=97=A0=E9=99=90=E5=BE=AA=E7=8E=AF=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=86=85=E5=AD=98=E6=BA=A2=E5=87=BA=20[AC-AISVC-50]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 JSON.stringify 比较避免 watch 循环触发 - 修复前端页面崩溃问题 --- ai-service-admin/src/components/common/ConfigForm.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ai-service-admin/src/components/common/ConfigForm.vue b/ai-service-admin/src/components/common/ConfigForm.vue index 569e4af..a365961 100644 --- a/ai-service-admin/src/components/common/ConfigForm.vue +++ b/ai-service-admin/src/components/common/ConfigForm.vue @@ -173,8 +173,10 @@ const initFormData = () => { watch( () => props.modelValue, - () => { - initFormData() + (newVal) => { + if (JSON.stringify(newVal) !== JSON.stringify(formData.value)) { + initFormData() + } }, { deep: true } ) @@ -190,7 +192,9 @@ watch( watch( formData, (val) => { - emit('update:modelValue', val) + if (JSON.stringify(val) !== JSON.stringify(props.modelValue)) { + emit('update:modelValue', val) + } }, { deep: true } )