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,6 +14,7 @@
14 14
15 - 修复黑暗主题刷新闪烁的白屏 15 - 修复黑暗主题刷新闪烁的白屏
16 - 修复标签页关闭其他功能失效问题 16 - 修复标签页关闭其他功能失效问题
  17 +- 修复表单已知问题
17 18
18 ## 2.3.0 (2021-04-10) 19 ## 2.3.0 (2021-04-10)
19 20
build/vite/plugin/index.ts
@@ -16,7 +16,7 @@ import { configThemePlugin } from './theme'; @@ -16,7 +16,7 @@ import { configThemePlugin } from './theme';
16 import { configImageminPlugin } from './imagemin'; 16 import { configImageminPlugin } from './imagemin';
17 import { configWindiCssPlugin } from './windicss'; 17 import { configWindiCssPlugin } from './windicss';
18 import { configSvgIconsPlugin } from './svgSprite'; 18 import { configSvgIconsPlugin } from './svgSprite';
19 -// import { configHmrPlugin } from './hmr'; 19 +import { configHmrPlugin } from './hmr';
20 20
21 export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { 21 export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
22 const { 22 const {
@@ -35,7 +35,7 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { @@ -35,7 +35,7 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
35 ]; 35 ];
36 36
37 // TODO 37 // TODO
38 - // !isBuild && vitePlugins.push(configHmrPlugin()); 38 + !isBuild && vitePlugins.push(configHmrPlugin());
39 39
40 // @vitejs/plugin-legacy 40 // @vitejs/plugin-legacy
41 VITE_LEGACY && isBuild && vitePlugins.push(legacy()); 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,8 +77,7 @@ export function useForm(props?: Props): UseFormReturnType {
77 }, 77 },
78 78
79 removeSchemaByFiled: async (field: string | string[]) => { 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 // TODO promisify 83 // TODO promisify
src/components/Form/src/hooks/useFormEvents.ts
@@ -88,7 +88,9 @@ export function useFormEvents({ @@ -88,7 +88,9 @@ export function useFormEvents({
88 */ 88 */
89 async function removeSchemaByFiled(fields: string | string[]): Promise<void> { 89 async function removeSchemaByFiled(fields: string | string[]): Promise<void> {
90 const schemaList: FormSchema[] = cloneDeep(unref(getSchema)); 90 const schemaList: FormSchema[] = cloneDeep(unref(getSchema));
91 - if (!fields) return; 91 + if (!fields) {
  92 + return;
  93 + }
92 94
93 let fieldList: string[] = isString(fields) ? [fields] : fields; 95 let fieldList: string[] = isString(fields) ? [fields] : fields;
94 if (isString(fields)) { 96 if (isString(fields)) {
@@ -107,6 +109,7 @@ export function useFormEvents({ @@ -107,6 +109,7 @@ export function useFormEvents({
107 if (isString(field)) { 109 if (isString(field)) {
108 const index = schemaList.findIndex((schema) => schema.field === field); 110 const index = schemaList.findIndex((schema) => schema.field === field);
109 if (index !== -1) { 111 if (index !== -1) {
  112 + delete formModel[field];
110 schemaList.splice(index, 1); 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.