0.0.1 • Published 2 years ago
@huanyer/utils v0.0.1
组件说明
huanyer-utils组件:前端常用的通用方法
- cache 保存 saveCache(key: string, value: any)
- cache 获取 getCache(key: string)
- cache 全删除 clearCacheAll()
cache 删除 clearCacheByKey(key: string)
字符串加密 compileStr(str: string)
字符串解谜 uncompileStr(str: string)
下载资源: downloadResource(data: any, fileName: string,mineType:string)
- 下载Image: downloadImage(data: any, fileName: string)
- 下载Excel: downloadExcel(data: any, fileName: string)
分子、分母格式百分比:formatPercent = (fenzi: number | null,fenmu: number | null,xiaoshuLength = 1)
获取url中?拼接的参数 getUrlParams(key: string)
localStorageCache 保存 saveLocalStorageCache(key: string, value: any)
- localStorageCache 获取 getLocalStorageCache(key: string)
- localStorageCache 全删除 clearLocalStorageCacheAll()
localStorageCache 删除 clearLocalStorageCacheByKey(key: string)
抖掉对象中value为空的key,且抖掉字段为null的key:shakeParams(params: any = {})
数字转成汉字:toChinesNum(num: number)
每三个字符添加一个指定符号,默认为逗号: toThousands(num: number | string, symbol?: string)
0.0.1
2 years ago