Bläddra i källkod

fix: 修复单词拼写错误,replace 'Filed' width 'Feild' (#2285)

前端爱码士 2 år sedan
förälder
incheckning
9aa2cf3ebf

+ 2 - 2
src/components/Form/src/BasicForm.vue

@@ -174,7 +174,7 @@
         updateSchema,
         resetSchema,
         appendSchemaByField,
-        removeSchemaByFiled,
+        removeSchemaByFeild,
         resetFields,
         scrollToField,
       } = useFormEvents({
@@ -268,7 +268,7 @@
         updateSchema,
         resetSchema,
         setProps,
-        removeSchemaByFiled,
+        removeSchemaByFeild,
         appendSchemaByField,
         clearValidate,
         validateFields,

+ 2 - 2
src/components/Form/src/hooks/useForm.ts

@@ -79,8 +79,8 @@ export function useForm(props?: Props): UseFormReturnType {
       });
     },
 
-    removeSchemaByFiled: async (field: string | string[]) => {
-      unref(formRef)?.removeSchemaByFiled(field);
+    removeSchemaByFeild: async (field: string | string[]) => {
+      unref(formRef)?.removeSchemaByFeild(field);
     },
 
     // TODO promisify

+ 4 - 4
src/components/Form/src/hooks/useFormEvents.ts

@@ -112,7 +112,7 @@ export function useFormEvents({
   /**
    * @description: Delete based on field name
    */
-  async function removeSchemaByFiled(fields: string | string[]): Promise<void> {
+  async function removeSchemaByFeild(fields: string | string[]): Promise<void> {
     const schemaList: FormSchema[] = cloneDeep(unref(getSchema));
     if (!fields) {
       return;
@@ -123,7 +123,7 @@ export function useFormEvents({
       fieldList = [fields];
     }
     for (const field of fieldList) {
-      _removeSchemaByFiled(field, schemaList);
+      _removeSchemaByFeild(field, schemaList);
     }
     schemaRef.value = schemaList;
   }
@@ -131,7 +131,7 @@ export function useFormEvents({
   /**
    * @description: Delete based on field name
    */
-  function _removeSchemaByFiled(field: string, schemaList: FormSchema[]): void {
+  function _removeSchemaByFeild(field: string, schemaList: FormSchema[]): void {
     if (isString(field)) {
       const index = schemaList.findIndex((schema) => schema.field === field);
       if (index !== -1) {
@@ -306,7 +306,7 @@ export function useFormEvents({
     updateSchema,
     resetSchema,
     appendSchemaByField,
-    removeSchemaByFiled,
+    removeSchemaByFeild,
     resetFields,
     setFieldsValue,
     scrollToField,

+ 1 - 1
src/components/Form/src/types/form.ts

@@ -33,7 +33,7 @@ export interface FormActionType {
   updateSchema: (data: Partial<FormSchema> | Partial<FormSchema>[]) => Promise<void>;
   resetSchema: (data: Partial<FormSchema> | Partial<FormSchema>[]) => Promise<void>;
   setProps: (formProps: Partial<FormProps>) => Promise<void>;
-  removeSchemaByFiled: (field: string | string[]) => Promise<void>;
+  removeSchemaByFeild: (field: string | string[]) => Promise<void>;
   appendSchemaByField: (
     schema: FormSchema,
     prefixField: string | undefined,

+ 2 - 2
src/views/demo/form/AppendForm.vue

@@ -21,7 +21,7 @@
   export default defineComponent({
     components: { BasicForm, CollapseContainer, PageWrapper, [Input.name]: Input, Button },
     setup() {
-      const [register, { appendSchemaByField, removeSchemaByFiled, validate }] = useForm({
+      const [register, { appendSchemaByField, removeSchemaByFeild, validate }] = useForm({
         schemas: [
           {
             field: 'field0a',
@@ -108,7 +108,7 @@
       }
 
       function del(field) {
-        removeSchemaByFiled([`field${field}a`, `field${field}b`, `${field}`]);
+        removeSchemaByFeild([`field${field}a`, `field${field}b`, `${field}`]);
         n.value--;
       }
 

+ 2 - 2
src/views/demo/form/DynamicForm.vue

@@ -181,7 +181,7 @@
   export default defineComponent({
     components: { BasicForm, CollapseContainer, PageWrapper },
     setup() {
-      const [register, { setProps, updateSchema, appendSchemaByField, removeSchemaByFiled }] =
+      const [register, { setProps, updateSchema, appendSchemaByField, removeSchemaByFeild }] =
         useForm({
           labelWidth: 120,
           schemas,
@@ -229,7 +229,7 @@
         );
       }
       function deleteField() {
-        removeSchemaByFiled('field11');
+        removeSchemaByFeild('field11');
       }
       return {
         register,