tsp-component
Version:
提供多端和react版本的UI组件
110 lines (101 loc) • 2.76 kB
TypeScript
/// <reference path="../exception/definition.d.ts" />
interface TspFrameworkConfig {
/** 微信票据 */
ticket?: string;
/** 微信appId */
appId?: string;
/** 微信configId */
wxConfigId?: string;
/** 微信调试是否开启 */
wxDebug?: boolean;
/** 图片服务器 */
imgHost: string;
/** 版本 */
version: string;
}
interface TspFrameworkRequestConfig {
/** 接口服务器 */
apiHost: string;
/** 接口请求超时的提示 */
timeoutStr?: string;
/** 超时后的默认回调 */
timeoutCallback?: (message: string) => void;
/** IndexedDB数据库名 */
dbName: string;
/** IndexedDB表名 */
tableName?: string;
/** 默认请求参数 */
defaultParams?: object;
/** 自定义请求头 */
customHeader?: any;
/** 请求成功后执行的函数 */
response: (result: object, callback: (status: boolean) => void, params: string) => void
}
interface TspFrameworkRouterOptions {
/** history类型 */
history?: 'hashHistory' | 'browserHistory';
/** 根组件 */
component?: JSX.Element;
/** 根组件onEnter */
onEnter?: (nextState: any, replace: (route: string) => void) => void;
/** 输出文件夹 */
outputDir: string;
/**子路由 */
childRoutes: {
/** 路由 */
path: string;
/** 输出文件名 */
outputFileName: string;
onEnter?: (nextState: any, replace: (route: string) => void) => void;
/** 异步加载组件 */
getComponent: (nextState, cb) => any;
}[];
}
interface TspFrameworkWeiXinOptions {
/** 当前页面地址 */
shareCurrentUrl?: string;
/** wx.ready回调 */
ready?: () => void;
}
interface TspFrameworkInitOptions {
/** 常规配置 */
config: TspFrameworkConfig;
/** 接口请求配置 */
request: TspFrameworkRequestConfig;
/** 路由配置 */
router?: TspFrameworkRouterOptions;
/** 微信配置 */
wx?: TspFrameworkWeiXinOptions;
/** 组件配置 */
component: {
Toast: {
/** 加载中状态的动画图 */
loadingSrc: string;
}
Exception?: {
/** 发送异常错误的接口 */
apiname?: string;
/** 产品编码 */
productCode: ExceptionProductCode;
}
View?: {
/** 默认请求成功返回结果的key */
dataKey: string;
}
ListView: {
/** 默认请求成功返回结果的key */
dataKey?: string[];
/** 默认开始页数 */
pageStart?: number;
/** 默认page字段 */
pageKey: string;
/** 默认pageSize字段 */
pageSizeKey: string;
}
EventTracking?: {
api: ApiCreateParams;
/** 接口服务器 */
host: string;
}
}
}