Global

Methods

arrayToTree(arr, pId)

Source:
数组转树结构
Parameters:
Name Type Description
arr Array 数组
pId String 父级ID
Returns:
tree 返回树

convertCurrency(n) → {string}

Source:
数字金额转大写
Example
convertCurrency(88888.88) => '捌万捌仟捌佰捌拾捌元捌角捌分'
Parameters:
Name Type Description
n 数字金额
Returns:
大写金额
Type
string

debounce(fn, delay) → {function}

Source:
函数防抖
Parameters:
Name Type Default Description
fn
delay 500 延迟时间 默认500ms
Returns:
返回防抖后的函数
Type
function

formatNumber(num)

Source:
金额数据千分位
Example
formatNumber(88888.88) => '88,888.88'
Parameters:
Name Type Description
num * 数值金额

getActualWidthOfChars(text, options) → {Object}

Source:
获取文本宽度
Parameters:
Name Type Description
text 文本内容
options
Returns:
Type
Object

getTreeChildren(data, id) → {Object}

Source:
获取树的子节点
Parameters:
Name Type Description
data * tree
id *
Returns:
Type
Object

getUID() → {*}

Source:
生成唯一的UID
Example
createUID() => 5d33b0fc-692d-41eb-e703-4aa76a8f
Returns:
{string} 返回生成的UID字符串
Type
*

IdCardInfo(val) → {Object}

Source:
解析身份证信息
Parameters:
Name Type Description
val String 身份证号
Returns:
身份信息对象
Type
Object

JSONP(config)

Source:
JSONP请求
Parameters:
Name Type Description
config

loadJS(url, callback)

Source:
加载JS文件
Parameters:
Name Type Description
url
callback

parseQueryString(url) → {Object}

Source:
url参数转对象
Parameters:
Name Type Description
url String default: window.location.href
Returns:
Type
Object

stringifyQueryString(obj) → {String}

Source:
对象序列化
Parameters:
Name Type Description
obj Object
Returns:
Type
String

throttle(fn, delayopt) → {*}

Source:
函数节流
Parameters:
Name Type Attributes Default Description
fn 需要做节流处理的函数
delay number <optional>
500 延迟时间 默认500ms
Returns:
{Function} 返回节流后的函数
Type
*

treeToArray(treeData, field) → {Array}

Source:
树结构转数组Array
Parameters:
Name Type Description
treeData 树元数据
field 父id
Returns:
Type
Array

unique(arr, uid)

Source:
数组对象去重
Parameters:
Name Type Description
arr
uid

waterMark(str)

Source:
页面水印、可显示10个汉字
Parameters:
Name Type Description
str 水印描述