fix: 修复ConfigForm组件watch无限循环导致内存溢出 [AC-AISVC-50]

- 添加 JSON.stringify 比较避免 watch 循环触发
- 修复前端页面崩溃问题
This commit is contained in:
MerCry 2026-02-26 12:17:52 +08:00
parent b11b5a027f
commit a4af74751f
1 changed files with 7 additions and 3 deletions

View File

@ -173,8 +173,10 @@ const initFormData = () => {
watch( watch(
() => props.modelValue, () => props.modelValue,
() => { (newVal) => {
if (JSON.stringify(newVal) !== JSON.stringify(formData.value)) {
initFormData() initFormData()
}
}, },
{ deep: true } { deep: true }
) )
@ -190,7 +192,9 @@ watch(
watch( watch(
formData, formData,
(val) => { (val) => {
if (JSON.stringify(val) !== JSON.stringify(props.modelValue)) {
emit('update:modelValue', val) emit('update:modelValue', val)
}
}, },
{ deep: true } { deep: true }
) )