fix: 修复ConfigForm组件watch无限循环导致内存溢出 [AC-AISVC-50]
- 添加 JSON.stringify 比较避免 watch 循环触发 - 修复前端页面崩溃问题
This commit is contained in:
parent
b11b5a027f
commit
a4af74751f
|
|
@ -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 }
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue