ptool
Version:
vue项目开发通用工具类封装
132 lines (131 loc) • 5.18 kB
TypeScript
import API from './libs/api.request';
import MockJs from './libs/mock';
declare const _default: {
createRoutes: (baseRoutes?: any, routes?: any, base?: string, homeName?: string, mode?: any, title?: string, beforeEach?: any, afterEach?: any) => import("vue-router").default;
environmentalJudgment: () => "ZheLiBanApp" | "AliPayMini" | "WeChat" | "DingTalkApp" | "CityBrain" | "H5";
isZheLiBanApp: () => boolean;
isAliPayMini: () => boolean;
isWeChat: () => boolean;
isH5: () => boolean;
browser: () => {
trident: boolean;
presto: boolean;
webKit: boolean;
gecko: boolean;
mobile: boolean;
ios: boolean;
android: boolean;
iPhone: boolean;
iPad: boolean;
webApp: boolean;
weixin: boolean;
qq: boolean;
};
isPC: () => boolean;
isAPP: () => boolean;
isDingTalkApp: () => boolean;
moment: {
format: (time?: Date, norms?: string) => string;
add: (num?: number, numNorms?: any, time?: Date, norms?: string) => string;
subtract: (num?: number, numNorms?: any, time?: Date, norms?: string) => string;
start: (time?: Date, norms?: string) => string;
end: (time?: Date, norms?: string, num?: number, numNorms?: string) => string;
diff: (endTime?: Date, startTime?: Date, type?: any) => number;
};
cookie: {
setCookie: (name: string, value: any, hours: number, path: string) => void;
getCookieValue: (name: string) => string;
deleteCookie: (name: string, path: string) => void;
};
log: {
setConsoleLog: (key: string, info: any) => void;
setErrorLog: (key: string, info: any) => void;
setApiLog: (key: string, info: any) => void;
info: (title: string, args: any) => void;
error: (title: string, args: any) => void;
debug: (title: string, args: any) => void;
warn: (title: string, args: any) => void;
table: (title: string, args: any) => void;
};
API: typeof API;
gbk: {
encode: (str: any) => any;
decode: (str: any) => any;
};
lStorage: {
setItem: (key: string, content: any) => void;
getItem: (key: string) => string;
removeItem: (key: string) => void;
clear: () => void;
getAll: () => any[];
removeDataFromKey: (key?: string) => void;
};
sStorage: {
setItem: (key: string, content: any) => void;
getItem: (key: string) => string | undefined;
removeItem: (key: string) => void;
clear: () => void;
};
MockJs: typeof MockJs;
echarts: {
setBarData: (key: any, data: any, coordinateAxis?: string) => void;
setLineData: (key: any, data: any, coordinateAxis?: string) => void;
};
requireDir: {
requireDir: (files: any, expendFiles?: any) => any;
};
url: {
getQuery(): any;
};
getUUID(len: number, radix: number): string;
getResult(arr?: never[], id?: string, find?: string, result?: string): string;
object: {
isObject(obj: any): boolean;
isFunction(obj: any): boolean;
isArray(obj: any): boolean;
isNull(obj: any): boolean;
isNotNull(obj: any): boolean;
length(obj: any): number;
getChildrenPath(obj: any, c: any, k: any): any;
merge(t: any, s: any, mergeArray?: boolean): any;
};
string: {
trim(str: any): string;
isBlank(str: any): boolean;
isNotBlank(str: any): boolean;
isEmpty(str: any): boolean;
isNotEmpty(str: any): boolean;
equalsIgnoreCase(a: any, b: any): boolean;
};
list: {
isEmpty(l: any): boolean;
isNotEmpty(l: any): boolean;
stringToList(s: any): any;
find(l: any, k: any, v: any, j: any): any[];
indexOf(l: any, k: any, v: any, b: any, j: any): number;
dedupe(array: []): never[];
remove(arr: [], key: any): void;
compare(property: string): (a: any, b: any) => number;
};
map: {
mapsExtVal(maps: any, key: any): any[];
listToMap(list: any, key: any): any;
isEqualForString(a: any, b: any): boolean;
isEmpty(m: any): boolean;
isNotEmpty(m: any): boolean;
isEqual(a: any, b: any, isWeak: any, isString: any): boolean;
keys(m: any): any[];
vals(m: any): any[];
};
formatPhoneNumber(phone: string): string;
numberToPercentage(percentage: any): string;
hasOneOf: (targetarr: any, arr: any) => any;
onMsg: (callback: any) => void;
compositeKey: (kes: string, fun: any) => void;
message: (type: any, content: string, duration?: number) => void;
confirm: (type?: any, title?: string, content?: string, okCallBack?: () => void, cancelCallBack?: () => void, confirmButtonText?: string, cancelButtonText?: string) => void;
alert: (type?: any, title?: string, content?: string, okCallBack?: () => void, confirmButtonText?: string) => void;
notice: (type: any, title: string, message: string, duration?: number) => void;
forIn: (obj: any, callback: any) => void;
};
export = _default;