This commit is contained in:
2025-07-23 15:14:50 +08:00
parent b6e8df30ff
commit 63442217fc
3 changed files with 18 additions and 7 deletions

View File

@ -194,6 +194,10 @@ const props = defineProps({
inline:{
type:Boolean,
default:true
},
disabled:{
type:Boolean,
default:false
}
});
const elform = ref();
@ -214,18 +218,25 @@ const reset = () =>{
elform.value.resetFields()
}
// 修改这里的watch逻辑避免无限循环
let isUpdatingFromProps = false;
watch(() => listQuery.value,(newVal) => {
if(newVal) emits("update:modelValue", newVal);
},{ immediate: true, deep: true });
if(newVal && !isUpdatingFromProps) {
emits("update:modelValue", newVal);
}
},{ deep: true });
watch(() => props.modelValue,(newVal) => {
// 只有在新值确实变化时才更新(避免空值覆盖)
if (newVal && Object.keys(newVal).length > 0) {
isUpdatingFromProps = true;
listQuery.value = { ...newVal };
setTimeout(() => {
isUpdatingFromProps = false;
}, 0);
}
},{ immediate: true, deep: true });
defineExpose({ submit,reset });
</script>