2.1.5 • Published 4 years ago

ruyue v2.1.5

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

npm模块

安装

npm i ruyue -s

更新

npm update ruyue -s

引用

import { 类名 } from 'ruyue/utils'
...
类名.方法名(参数)

具体包

  • h5_native

    处理app端方法接口

  • utils

    工具类

1. StringUtils -- 字符串类

方法名称方法描述方法参数方法返回
trim去除空格String, type(1所有空格(默认)/2前后空格/3前空格/4后空格)String
hideStrBySymbol隐藏字符串部分字符,用*代替String, num(显示最后几位)String

2. DateUtils -- 日期类

方法名称方法描述方法参数方法返回
formatDate日期格式化dateValue(日期, 类型Date/String/Nmuber), format(由yyyy,MM,dd,hh,mm,ss,w组成, 默认'yyyy/MM/dd hh:mm:ss')String
getWeek获取星期dateVlaue(同上, 默认new Date())日/一/二/三/四/五/六
getCurrentDate获取当前日期format(同上)String
compareDate比较两个时间的大小dateVlaue1, dateVlaue21前者大/2后者大/0相等
getDistanceDate获取距离目标日期num的日期dateValue, type(yyyy/MM/dd/hh/mm/ss), num(数值), formatString

3. ArrayUtils -- 数组类

方法名称方法描述方法参数方法返回
deepClone深拷贝数组或对象Array/ObjectArray/Object
unique去重ArrayArray
remove删除其中一个元素Array, StringArray

4. TypeUtils -- 类型判断类

方法名称方法描述方法参数方法返回
isString是否字符串valueBoolean
isNumber是否数字valueBoolean
isBoolean是否布尔值valueBoolean
isFunction是否函数valueBoolean
isNull是否为nullvalueBoolean
isUndefined是否undefinedvalueBoolean
isObject是否对象valueBoolean
isArray是否数组valueBoolean
isDate是否时间valueBoolean
isRegExp是否正则valueBoolean
isError是否错误对象valueBoolean
isSymbol是否Symbol函数valueBoolean
isPromise是否Promise对象valueBoolean
isSet是否Set对象valueBoolean
isFalse是否为falsevalueBoolean
isTrue是否truevalueBoolean
checkStr类型校验value, type(phone/tel/HMCode/PassportCode/postal/QQ/email/English/chinese/lower/UPPER)Boolean

5. SaveUtils -- 存储类

方法名称方法描述方法参数方法返回
setCookie设置cookiekey, value, day(过期天数)
getCookie获取cookiekeyvalue
removeCookie删除cookiekey
setLocal设置localStoragekey, value(String/Object/..)
getLocal获取localStoragekeyvalue(同上)
removeLocal移除localStoragekey
clearLocal移除所有localStorage
setSession设置sessionStoragekey, value(同上)
getSession获取sessionStoragekeyvalue(同上)
removeSession移除sessionStoragekey
clearSession移除所有sessionStorage

6. MobileUtils -- 手机兼容类

方法名称方法描述方法参数方法返回
scrollFn解决移动端轮播图左右滑动(elementUI)vm(vue实例)
setInputBlur解决ios微信端input,select框弹起不回弹问题

7. OtherUtils -- 其他类

方法名称方法描述方法参数方法返回
GetQueryString获取地址URL参数namevalue
isEmpty是否为空value(String/Array/Object)Boolean
equals是否相等value1, value2Boolean
serializeForm获取表单提交url的所有参数(已序列化)form元素的id值String值

更新日志

2.2.3 (2019/11/20)

  • 添加日期类-计算两时间差方法

2.2.0 (2019/11/20)

  • 添加日志包、性能包

2.1.0 (2019/11/20)

  • 转换代码为ES5格式
2.1.5

4 years ago

2.1.4

4 years ago

2.1.3

4 years ago

2.1.2

4 years ago

2.1.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago