Commit 38f5072695f63b30c6ce6b2741b003db605abd82

Authored by Vben
1 parent b92b8a3c

fix(form): remove field binding when deleting schema #471

CHANGELOG.zh_CN.md
... ... @@ -14,6 +14,7 @@
14 14  
15 15 - 修复黑暗主题刷新闪烁的白屏
16 16 - 修复标签页关闭其他功能失效问题
  17 +- 修复表单已知问题
17 18  
18 19 ## 2.3.0 (2021-04-10)
19 20  
... ...
build/vite/plugin/index.ts
... ... @@ -16,7 +16,7 @@ import { configThemePlugin } from './theme';
16 16 import { configImageminPlugin } from './imagemin';
17 17 import { configWindiCssPlugin } from './windicss';
18 18 import { configSvgIconsPlugin } from './svgSprite';
19   -// import { configHmrPlugin } from './hmr';
  19 +import { configHmrPlugin } from './hmr';
20 20  
21 21 export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
22 22 const {
... ... @@ -35,7 +35,7 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
35 35 ];
36 36  
37 37 // TODO
38   - // !isBuild && vitePlugins.push(configHmrPlugin());
  38 + !isBuild && vitePlugins.push(configHmrPlugin());
39 39  
40 40 // @vitejs/plugin-legacy
41 41 VITE_LEGACY && isBuild && vitePlugins.push(legacy());
... ...
src/components/Form/src/hooks/useForm.ts
... ... @@ -77,8 +77,7 @@ export function useForm(props?: Props): UseFormReturnType {
77 77 },
78 78  
79 79 removeSchemaByFiled: async (field: string | string[]) => {
80   - const form = await getForm();
81   - form.removeSchemaByFiled(field);
  80 + unref(formRef)?.removeSchemaByFiled(field);
82 81 },
83 82  
84 83 // TODO promisify
... ...
src/components/Form/src/hooks/useFormEvents.ts
... ... @@ -88,7 +88,9 @@ export function useFormEvents({
88 88 */
89 89 async function removeSchemaByFiled(fields: string | string[]): Promise<void> {
90 90 const schemaList: FormSchema[] = cloneDeep(unref(getSchema));
91   - if (!fields) return;
  91 + if (!fields) {
  92 + return;
  93 + }
92 94  
93 95 let fieldList: string[] = isString(fields) ? [fields] : fields;
94 96 if (isString(fields)) {
... ... @@ -107,6 +109,7 @@ export function useFormEvents({
107 109 if (isString(field)) {
108 110 const index = schemaList.findIndex((schema) => schema.field === field);
109 111 if (index !== -1) {
  112 + delete formModel[field];
110 113 schemaList.splice(index, 1);
111 114 }
112 115 }
... ...
src/components/Icon/README.md deleted 100644 → 0
1   -### `Icon.vue`
2   -
3   -```html
4   -<Icon icon="mdi:account" />
5   -```
6   -
7   -The icon id follows the rules in [Iconify](https://iconify.design/) which you can use any icons from the supported icon sets.