import BSL from '../../typings'; interface Data { [key: string]: string | boolean | number | Data | (string | boolean | number)[] } export type Method = | 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' export interface CoreProps { api: string; headers?: Record; data?: Data; /** 是否禁用发送请求 */ disabled?: boolean; method?: Method; /** 请求成功 */ onComplete?: (response: BSL.Response) => void; /** catch时执行 */ onFail?: (response: BSL.Response) => void; /** onFinally先于onComplete和onFail执行 */ onFinally?: (response: BSL.Response) => void; /** onSubmit前段回调,可用于拦截默认的验证逻辑 */ onSubmitBefore?: () => Promise; /** onSubmit后段回调,默认验证逻辑执行之后 */ onSubmit?: () => void; /** 提交时,表单有错误内容的提示语 * @default 请检查提交内容 */ toastText?: string; }