fix(form): fix the problem of form props monitoring close #322

This commit is contained in:
Vben 2021-03-04 23:11:38 +08:00
parent ce93e46faf
commit 83a3460356
2 changed files with 18 additions and 5 deletions

View File

@ -1,3 +1,10 @@
## Wip
### 🐛 Bug Fixes
- 修复`Description`已知问题
- 修复`BasicForm`已知问题
## 2.0.2 (2021-03-04)
### ✨ Refactor

View File

@ -1,4 +1,4 @@
import { ref, onUnmounted, unref, nextTick, watchEffect } from 'vue';
import { ref, onUnmounted, unref, nextTick, watch } from 'vue';
import { isInSetup } from '/@/utils/helper/vueHelper';
import { isProdMode } from '/@/utils/env';
@ -39,12 +39,18 @@ export function useForm(props?: Props): UseFormReturnType {
if (unref(loadedRef) && isProdMode() && instance === unref(formRef)) return;
formRef.value = instance;
loadedRef.value = true;
watchEffect(() => {
props && instance.setProps(getDynamicProps(props));
});
watch(
() => props,
() => {
props && instance.setProps(getDynamicProps(props));
},
{
immediate: true,
deep: true,
}
);
}
const methods: FormActionType = {