1.0.4 • Published 6 years ago
pm-js-utils v1.0.4
仁仁医疗常用 Javascript 代码块
电梯
getHashParams(hash)
获取 hash 参数
- 参数
Param | Type | Description | Sample |
---|---|---|---|
hash | string | url上#/{path}后内容 | "#/?id=a&user=abc" |
返回
Type Description Sample Object -- {id: 'a', user: 'abc'}
getUrlParams(search)
获取 url 参数
- 参数
Param | Type | Description | Sample |
---|---|---|---|
search | string | url上/{path}后内容 | "?id=a&user=abc" |
返回
Type Description Sample Object -- {id: 'a', user: 'abc'}
randomString(length)
生成随机字符串
- 参数
Param | Type | Description | Sample |
---|---|---|---|
length | number | 生成字符串的长度 | 10 |
返回
Type Description Sample string -- "k2pnnc01f8hun"
readableDate(dateString)
将日期转为中文年月日日期
- 参数
Param | Type | Description | Sample |
---|---|---|---|
dateString | string | 标准日期字符串 | "2010-10-01" |
返回
Type Description Sample string 中文格式化日期 "2010年10月1日"
setStorage(params)
批量 localstorage.setItem()
- 参数
Param | Type | Description | Sample |
---|---|---|---|
{key/value} | object | key/value | {openId: "wewe", userId: "3"} |
- 返回
无
isWechat()
判断是否在微信浏览器
- 参数 无
返回
Type Description Sample boolean 是或否 true