0.0.28 • Published 5 months ago

haier-methods v0.0.28

Weekly downloads
-
License
-
Repository
-
Last release
5 months ago

安装

npm i haier-methods

使用

import hmethods from 'haier-methods';
console.log(hmethods.changetime(new Date(), 1));

or

import { changetime } from 'haier-methods';
console.log(changetime(new Date(), 1));

发布

发布https://x.haier.net/console/ci/flow/detail/font_haier-ui

介绍

属性说明参数返回值示例
changetime(time,type)不同时间格式转换time: 时间; type: 返回值类型type=1: 2022-11-11 10:30:20;type=2: 2022-11-11;type=3: 2022年11月11日 10:30;type为其他或不传: 2022-11-11 10:30)
getType(data)获取数据类型data: 传入数据String, Number, Boolean, Object ,Array, Function, Null, UndefinedgetType('d')
trim(str)去除字符串前后空格str: 传入字符串处理后的字符串
trimParams(obj)返回去除对象空属性对象obj: 传入对象处理后的对象
formRuleError()el-form校验失败自动获取焦点
cloneDeep(data)深拷贝data: 传入数据拷贝数据
exportFunc(url, params, method)导出文件(form)url: 请求地址, params: 传入参数, method: 请求方式(默认post)
downLoadUrl(url, filename)下载链接地址url: 链接地址, filename: 文件名称
changeCase(str, type)字符串大小写str: 传入字符串, type: 1:首字母大写 2:首页母小写 3:大小写转换 4:全部大写 5:全部小写(默认4)转换后数据
typeJudgment(data, type)类型检测data: 传入数据, type: 当传入type时则验证类型,返回布尔值,否则则返回传入数据data的类型boolean/类型
uniqueArray(data, key)数组去重(支持JSON数组)data: 传入数据, key: 当数组为json数组时,需要以哪个key的数据来去重。否则可以不传去重后的数组
downloadBlob(data, fileName)下载文件流data: 传入数据({data: 具体内容}),fileName:下载文件名
arithmetic.floatMultiply(num1,num2)数字运算-解决精度问题:乘法num: 传入数字,num1*num2运算结果
arithmetic.floatDivide(num1,num2)数字运算-解决精度问题:除法num: 传入数字,num1*num2运算结果
arithmetic.floatAdd(num1,num2)数字运算-解决精度问题:加法num: 传入数字,num1*num2运算结果
arithmetic.floatSub(num1,num2)数字运算-解决精度问题:减法num: 传入数字,num1*num2运算结果
arithmetic.floatMod(num1,num2)数字运算-解决精度问题:取余num: 传入数字,num1*num2运算结果
loading.start()打开loading
loading.end()关闭loading
generateUuid(type)返回type + 随机字符串idtype: 字符串type + 随机字符串idgenerateUuid(), generateUuid('text')
fileSuffixType(fileName, otherName)根据文件名称返回文件类型fileName: 文件名(需带后缀),otherName: 无法判断类型时返回值(默认是文件后缀名)文件类型
numberToChinese(num, type)整数转汉字num: 数据或字符串,type: 默认不传;type='case'b表示大写转换结果
storage.set(key, value, category = LOCAL, expired, cpath)缓存设置category可选:local\session\cookie, expired和cpath存储cookie时使用storage.set('name', '张三')
storage.get(key, category = LOCAL)缓存查询storage.get('name')
storage.clear(category = LOCAL)缓存清空storage.clear('cookie')
storage.remove(key, category = LOCAL)缓存删除storage.remove('name')
executeCopy(text)复制文本text: 需要复制的文本executeCopy('复制内容')
0.0.25

5 months ago

0.0.26

5 months ago

0.0.27

5 months ago

0.0.28

5 months ago

0.0.20

12 months ago

0.0.21

12 months ago

0.0.22

11 months ago

0.0.23

11 months ago

0.0.19

1 year ago

0.0.18

1 year ago

0.0.17

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago