Global

Methods

deepCloneArr(data) → {Array}

Source:
深拷贝数组
Example
deepCloneArr([{a: 1}]) => [{a: 1}]
Parameters:
Name Type Description
data Array 数组
Returns:
Type
Array

generateUUID() → {String}

Source:
生成UUID
Example
generateUUID() => '026841df-27db-4ec6-b4e8-6a4c7ee7854f'
Returns:
返回字符串
Type
String

getLetter() → {Number}

Source:
生成26个字母
Example
getLetter() => 'A, B, C ... Z'
Returns:
26个字母数组
Type
Number

getObjVal(object, path) → {any}

Source:
获取对象的属性值
Example
const object = { 'a': { 'b': { 'c': 3 } } }
getObjVal(object, "a.b.c") => 3
Parameters:
Name Type Description
object object 需要获取值的对象
path string 需要获取值的属性路径
Returns:
任意值
Type
any

randomWord(randomFlag, min, max) → {String}

Source:
产生任意长度随机字母数字组合
Example
randomWord(false, 10, 100) => 8rgBAH1AiS
Parameters:
Name Type Description
randomFlag String 是否任意长度
min String 任意长度最小位[固定位数]
max String 任意长度最大位
Returns:
Type
String

removeArrEl(data, ele, key) → {Array}

Source:
数组删除元素 返回删除元素的数组
Example
removeArrEl({data: [{a:1}, {b: 2}], ele: 2, key: "b"}) => [ { a: 1 } ]
Parameters:
Name Type Description
data Array 原数组
ele String 元素
key String 对象key
Returns:
返回删除元素的数组
Type
Array

scrollAnimation(currentY, targetY)

Source:
动画滚动至目标位置
Example
scrollAnimation(0, 100)
Parameters:
Name Type Description
currentY Number 当前位置
targetY Number 目标位置

sliceGroup(data, size) → {Array}

Source:
分割数组
Example
sliceGroup([1,2,3,4,5], 2) => [ [ 1, 2 ], [ 3, 4 ], [ 5 ] ]
Parameters:
Name Type Description
data Array 原数组
size Number 每一个分割的数组长度
Returns:
分割后的数组
Type
Array

toUTF8(str) → {String}

Source:
中文字符串转成utf8
Example
toUTF8("中文") => [ 228, 184, 173, 230, 150, 135 ]  
Parameters:
Name Type Description
str String 需要转换的中文字符
Returns:
utf-8字符
Type
String