fix: 优化watch 修改编辑用户弹窗样式
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user