提交 768fadbf 编写于 作者: J JinMao

fix: Form method name field

上级 9aa2cf3e
...@@ -174,7 +174,7 @@ ...@@ -174,7 +174,7 @@
updateSchema, updateSchema,
resetSchema, resetSchema,
appendSchemaByField, appendSchemaByField,
removeSchemaByFeild, removeSchemaByField,
resetFields, resetFields,
scrollToField, scrollToField,
} = useFormEvents({ } = useFormEvents({
...@@ -268,7 +268,7 @@ ...@@ -268,7 +268,7 @@
updateSchema, updateSchema,
resetSchema, resetSchema,
setProps, setProps,
removeSchemaByFeild, removeSchemaByField,
appendSchemaByField, appendSchemaByField,
clearValidate, clearValidate,
validateFields, validateFields,
......
...@@ -79,8 +79,8 @@ export function useForm(props?: Props): UseFormReturnType { ...@@ -79,8 +79,8 @@ export function useForm(props?: Props): UseFormReturnType {
}); });
}, },
removeSchemaByFeild: async (field: string | string[]) => { removeSchemaByField: async (field: string | string[]) => {
unref(formRef)?.removeSchemaByFeild(field); unref(formRef)?.removeSchemaByField(field);
}, },
// TODO promisify // TODO promisify
......
...@@ -112,7 +112,7 @@ export function useFormEvents({ ...@@ -112,7 +112,7 @@ export function useFormEvents({
/** /**
* @description: Delete based on field name * @description: Delete based on field name
*/ */
async function removeSchemaByFeild(fields: string | string[]): Promise<void> { async function removeSchemaByField(fields: string | string[]): Promise<void> {
const schemaList: FormSchema[] = cloneDeep(unref(getSchema)); const schemaList: FormSchema[] = cloneDeep(unref(getSchema));
if (!fields) { if (!fields) {
return; return;
...@@ -306,7 +306,7 @@ export function useFormEvents({ ...@@ -306,7 +306,7 @@ export function useFormEvents({
updateSchema, updateSchema,
resetSchema, resetSchema,
appendSchemaByField, appendSchemaByField,
removeSchemaByFeild, removeSchemaByField,
resetFields, resetFields,
setFieldsValue, setFieldsValue,
scrollToField, scrollToField,
......
...@@ -33,7 +33,7 @@ export interface FormActionType { ...@@ -33,7 +33,7 @@ export interface FormActionType {
updateSchema: (data: Partial<FormSchema> | Partial<FormSchema>[]) => Promise<void>; updateSchema: (data: Partial<FormSchema> | Partial<FormSchema>[]) => Promise<void>;
resetSchema: (data: Partial<FormSchema> | Partial<FormSchema>[]) => Promise<void>; resetSchema: (data: Partial<FormSchema> | Partial<FormSchema>[]) => Promise<void>;
setProps: (formProps: Partial<FormProps>) => Promise<void>; setProps: (formProps: Partial<FormProps>) => Promise<void>;
removeSchemaByFeild: (field: string | string[]) => Promise<void>; removeSchemaByField: (field: string | string[]) => Promise<void>;
appendSchemaByField: ( appendSchemaByField: (
schema: FormSchema, schema: FormSchema,
prefixField: string | undefined, prefixField: string | undefined,
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<script lang="ts"> <script lang="ts">
import { defineComponent, ref } from 'vue'; import { defineComponent, ref } from 'vue';
import { BasicForm, useForm } from '/@/components/Form/index'; import { BasicForm, useForm } from '/@/components/Form/index';
import { CollapseContainer } from '/@/components/Container/index'; import { CollapseContainer } from '/@/components/Container';
import { Input } from 'ant-design-vue'; import { Input } from 'ant-design-vue';
import { PageWrapper } from '/@/components/Page'; import { PageWrapper } from '/@/components/Page';
import { Button } from '/@/components/Button'; import { Button } from '/@/components/Button';
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
export default defineComponent({ export default defineComponent({
components: { BasicForm, CollapseContainer, PageWrapper, [Input.name]: Input, Button }, components: { BasicForm, CollapseContainer, PageWrapper, [Input.name]: Input, Button },
setup() { setup() {
const [register, { appendSchemaByField, removeSchemaByFeild, validate }] = useForm({ const [register, { appendSchemaByField, removeSchemaByField, validate }] = useForm({
schemas: [ schemas: [
{ {
field: 'field0a', field: 'field0a',
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
} }
function del(field) { function del(field) {
removeSchemaByFeild([`field${field}a`, `field${field}b`, `${field}`]); removeSchemaByField([`field${field}a`, `field${field}b`, `${field}`]);
n.value--; n.value--;
} }
......
...@@ -181,7 +181,7 @@ ...@@ -181,7 +181,7 @@
export default defineComponent({ export default defineComponent({
components: { BasicForm, CollapseContainer, PageWrapper }, components: { BasicForm, CollapseContainer, PageWrapper },
setup() { setup() {
const [register, { setProps, updateSchema, appendSchemaByField, removeSchemaByFeild }] = const [register, { setProps, updateSchema, appendSchemaByField, removeSchemaByField }] =
useForm({ useForm({
labelWidth: 120, labelWidth: 120,
schemas, schemas,
...@@ -229,7 +229,7 @@ ...@@ -229,7 +229,7 @@
); );
} }
function deleteField() { function deleteField() {
removeSchemaByFeild('field11'); removeSchemaByField('field11');
} }
return { return {
register, register,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册