Skip to content

Commit 83a3460

Browse files
committed
fix(form): fix the problem of form props monitoring close #322
1 parent ce93e46 commit 83a3460

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

CHANGELOG.zh_CN.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## Wip
2+
3+
### 🐛 Bug Fixes
4+
5+
- 修复`Description`已知问题
6+
- 修复`BasicForm`已知问题
7+
18
## 2.0.2 (2021-03-04)
29

310
### ✨ Refactor

src/components/Form/src/hooks/useForm.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ref, onUnmounted, unref, nextTick, watchEffect } from 'vue';
1+
import { ref, onUnmounted, unref, nextTick, watch } from 'vue';
22

33
import { isInSetup } from '/@/utils/helper/vueHelper';
44
import { isProdMode } from '/@/utils/env';
@@ -39,12 +39,18 @@ export function useForm(props?: Props): UseFormReturnType {
3939
if (unref(loadedRef) && isProdMode() && instance === unref(formRef)) return;
4040

4141
formRef.value = instance;
42-
4342
loadedRef.value = true;
4443

45-
watchEffect(() => {
46-
props && instance.setProps(getDynamicProps(props));
47-
});
44+
watch(
45+
() => props,
46+
() => {
47+
props && instance.setProps(getDynamicProps(props));
48+
},
49+
{
50+
immediate: true,
51+
deep: true,
52+
}
53+
);
4854
}
4955

5056
const methods: FormActionType = {

0 commit comments

Comments
 (0)