0.0.17 • Published 4 months ago

haier-methods v0.0.17

Weekly downloads
-
License
-
Repository
-
Last release
4 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')
0.0.17

4 months ago

0.0.12

8 months ago

0.0.13

8 months ago

0.0.14

7 months ago

0.0.15

7 months ago

0.0.16

7 months ago

0.0.10

1 year ago

0.0.11

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago