npm i licos-tools
import tools from 'licos-tools'
camelToUnderline(str: string): string
underlineToCamel(str: string): string
objectToArray(Obj: Object):Array<object>
arrayToTree(list: [], parentKey = ''): Array<object>
treeToArray(list: any, newArr: any): Array<object>
arrayToTreeByKey(list: Array<object>, pid = '', customField = { key: 'id', parentKey: 'pid' }): Array<Object>
uuid (len: number, radix: number): string
实例:tools.common.uuid(8,16);//获取8位16进制的字符串
返回:1f2a3c41
guid = (): string
实例:tools.common.guid();//获取8位16进制的字符串
返回:1d4ac2d2-11c8-4bdb-adb9-e5b96e96d027
checkVer(oldVer: string, newVer: string): boolean
实例:tools.common.checkVer('10.0.1','10.0.2');
返回:true
fixLen(str: string, len: number): string
实例:tools.common.fixLen('我们是联诚科技',3);
返回:我们是...
screen(cb: Function): void
实例:tools.common.screen((resizedWinWidth, resizedWinHeight, scale)=>{
});
const context={title:'',name:''}
const exp=new tools.express(context);
//模板解析
const text = exp.template('<div>{{title}}</div><span>{{name}}</span>');
//计算
const ret = exp.compute('1+1');
//代码执行
const ret = exp.execute('let a = title; return a;');
on(topic: string, cb: Function): void
实例:tools.msgBus.on('topic',(type,e)=>{
});
emit(topic: string, data: Object): void
实例:tools.msgBus.emit('topic',{a:1});