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

fix: Form method name field

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