Commit 83a34603562e6358203b834b8feb59b0b44dbbcd

Authored by Vben
1 parent ce93e46f

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

CHANGELOG.zh_CN.md
  1 +## Wip
  2 +
  3 +### 🐛 Bug Fixes
  4 +
  5 +- 修复`Description`已知问题
  6 +- 修复`BasicForm`已知问题
  7 +
1 8 ## 2.0.2 (2021-03-04)
2 9  
3 10 ### ✨ Refactor
... ...
src/components/Form/src/hooks/useForm.ts
1   -import { ref, onUnmounted, unref, nextTick, watchEffect } from 'vue';
  1 +import { ref, onUnmounted, unref, nextTick, watch } from 'vue';
2 2  
3 3 import { isInSetup } from '/@/utils/helper/vueHelper';
4 4 import { isProdMode } from '/@/utils/env';
... ... @@ -39,12 +39,18 @@ export function useForm(props?: Props): UseFormReturnType {
39 39 if (unref(loadedRef) && isProdMode() && instance === unref(formRef)) return;
40 40  
41 41 formRef.value = instance;
42   -
43 42 loadedRef.value = true;
44 43  
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 + );
48 54 }
49 55  
50 56 const methods: FormActionType = {
... ...