types: add SwipeInstance type (#9158)

This commit is contained in:
neverland
2021-07-30 14:25:14 +08:00
committed by GitHub
parent 44fb849a5f
commit 32e77d71ab
17 changed files with 155 additions and 98 deletions
+3 -23
View File
@@ -1,9 +1,4 @@
import {
PropType,
defineComponent,
ExtractPropTypes,
ComponentPublicInstance,
} from 'vue';
import { PropType, defineComponent, ExtractPropTypes } from 'vue';
// Utils
import { truthProp, createNamespace } from '../utils';
@@ -19,6 +14,7 @@ import type {
FieldValidateError,
FieldValidateTrigger,
} from '../field/types';
import type { FormExpose } from './types';
const [name, bem] = createNamespace('form');
@@ -41,23 +37,7 @@ const props = {
},
};
type FormProps = ExtractPropTypes<typeof props>;
type FormExpose = {
submit: () => void;
validate: (name?: string | string[] | undefined) => Promise<void>;
scrollToField: (
name: string,
options?: boolean | ScrollIntoViewOptions | undefined
) => void;
resetValidation: (name?: string | string[] | undefined) => void;
};
export type FormInstance = ComponentPublicInstance<FormProps, FormExpose>;
export type FormProvide = {
props: FormProps;
};
export type FormProps = ExtractPropTypes<typeof props>;
export default defineComponent({
name,
+1 -1
View File
@@ -5,4 +5,4 @@ const Form = withInstall<typeof _Form>(_Form);
export default Form;
export { Form };
export type { FormInstance } from './Form';
export type { FormInstance } from './types';
+18
View File
@@ -0,0 +1,18 @@
import type { ComponentPublicInstance } from 'vue';
import type { FormProps } from './Form';
export type FormExpose = {
submit: () => void;
validate: (name?: string | string[] | undefined) => Promise<void>;
scrollToField: (
name: string,
options?: boolean | ScrollIntoViewOptions | undefined
) => void;
resetValidation: (name?: string | string[] | undefined) => void;
};
export type FormProvide = {
props: FormProps;
};
export type FormInstance = ComponentPublicInstance<FormProps, FormExpose>;