tsp-component
Version:
提供多端和react版本的UI组件
93 lines (85 loc) • 1.52 kB
TypeScript
interface TspComponentAjaxCacheAddData {
/**
* 主键
*/
api: string;
/**
* 键值
*/
value: string;
}
interface TspComponentAjaxCacheParams {
/**
* 数据库名称
*/
dbName: string;
/**
* 数据库表名
*/
tableName: string;
}
/**
* Api发送的参数
*/
interface ApiSendParams {
/**
* api名称
*/
api: string;
/**
* 请求类型
*/
type?: 'get' | 'post' | 'put' | 'delete';
/**
* 请求参数
*/
params?: Object;
/**
* 请求成功后的回调
*/
success?: (result: Object, status: boolean, cacheUpdate?: boolean) => void;
/**
* 超时后的提示
*/
timeoutStr?: string;
/**
* 超时时间
*/
timeout?: number;
/**
* 超时后执行的函数
*/
timeoutCallback?: Function;
/**
* 请求成功和超时都会执行的函数
*/
complete?: Function;
/**
* 是否用数据库缓存请求后的结果
*/
isCache: boolean;
/**
* 缓存读取成功后执行的函数
*/
cacheReadSuccess?: Function;
/**
* header Content-type
*/
contentType?: string;
/**
* 自定义头部
*/
customHeader?: any;
}
/**
* api创建时的参数
*/
interface ApiCreateParams extends ApiSendParams {
response: any;
}
/**
* 接口请求状态
*/
type ApiStatus = 'loading' | 'complete' | 'fail' | 'timeout' | 'empty';
interface TspComponentAjaxPostOption extends ApiSendParams {
}