fix: 优化watch 修改编辑用户弹窗样式

This commit is contained in:
ZhuRui
2026-07-27 09:51:30 +08:00
parent 17d5c85904
commit e3e66ec03b
11 changed files with 146 additions and 161 deletions
+8 -11
View File
@@ -1,4 +1,5 @@
import { defineComponent, ref, reactive, watch } from 'vue';
import { defineComponent, ref, reactive } from 'vue';
import { useEffect } from '@/hooks';
import { Modal, Form, Input, Button, message } from 'ant-design-vue';
import { TIPS_TEXT, newPasswordRules, confirmNewPasswordRules } from './controller';
import styles from './style.module.less';
@@ -30,16 +31,12 @@ export default defineComponent({
const formData = reactive(getDefaultForm());
/** 监听 visible 重置表单 */
watch(
() => props.visible,
(val) => {
if (val) {
Object.assign(formData, getDefaultForm());
setTimeout(() => formRef.value?.clearValidate(), 0);
}
},
{ immediate: true },
);
useEffect(() => {
if (props.visible) {
Object.assign(formData, getDefaultForm());
setTimeout(() => formRef.value?.clearValidate(), 0);
}
}, [() => props.visible]);
/** 提交 */
const handleSubmit = async () => {