Methods
add_num(augend, addend) → {number}
- Source:
功能: 两个数相加
Parameters:
Name | Type | Description |
---|---|---|
augend |
number | 被加数 |
addend |
number | 加数 |
Returns:
- 两数相加的结果值
- Type
- number
anti_shake(callback, dayNumopt) → {undefined}
- Source:
功能: 防抖功能函数,对特殊事件进行防抖操作,且只执行最后一次当前传入的callback函数;
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
callback |
function | 执行函数 |
||
dayNum |
number | string |
<optional> |
300
|
default is 300 延时时间 如果字符串isNaN后结果为true把dayNum重置为300 |
Returns:
- undefined
- Type
- undefined
axios_interceptors(instance, taskopt) → {undefined}
- Source:
功能:axios的interceptors的request&response的二次封装
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
instance |
axios | axios实例话对象 |
|
task |
object |
<optional> |
配置对象有四个参数 |
Returns:
- undefined
- Type
- undefined
base64ToBlob(base64Url) → {Blob}
- Source:
功能:图片base64转换为blob
Parameters:
Name | Type | Description |
---|---|---|
base64Url |
string |
Returns:
- Blob对象
- Type
- Blob
cavar_type(currTask) → {String}
- Source:
功能:判断数据类型功能函数
Parameters:
Name | Type | Description |
---|---|---|
currTask |
Any | 判断类型的格式 |
Returns:
- 返回传入的参数类型,以小写字符串的形式返回
- Type
- String
chunk_towArray(arr, arrNumopt) → {array}
- Source:
功能:普通数组拆分为二维数组 返回一个包围区块的新数组
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
arr |
array | 目标数组 |
||
arrNum |
number |
<optional> |
1
|
default is 2,拆分成二维数组的每一个数组的成员个数 |
Returns:
- 返回处理后的二维数组
- Type
- array
clone_dep(data) → {object|array}
- Source:
功能:深拷贝对象或数组
Parameters:
Name | Type | Description |
---|---|---|
data |
object | array | 目标对象 |
Returns:
-深拷贝对象或数组
- Type
- object | array
cookie_js(any) → {undefined}
- Source:
功能:cookie操作函数, 建议在做任何操作前先看一下当前代码的远吗
Parameters:
Name | Type | Description |
---|---|---|
any |
any | 所有操作建议先观看源码 |
Returns:
- undefined
- Type
- undefined
count_down(arr, targets) → {array}
- Source:
功能:金钱相关特殊字符数组排数
Parameters:
Name | Type | Description |
---|---|---|
arr |
array | 目标数组 成员为数组或者字符串 |
targets |
string | 标记分隔符例如:',' |
Returns:
- 数组,如果没有满足执行函数return 值的函数规则时 返回空数组
- Type
- array
deepClone(data) → {object|array}
- Source:
功能:深拷贝对象或数组-检测该属性是否为对象本身的属性(不能拷贝原型对象的属性)
Parameters:
Name | Type | Description |
---|---|---|
data |
any | 目标对象 |
Returns:
-深拷贝对象或数组
- Type
- object | array
dispatchGMSEvent(data, eventName) → {object}
- Source:
功能:推进或触发自定义事件
Parameters:
Name | Type | Default | Description |
---|---|---|---|
data |
object | 目标对象,自定义事件发送的参数 |
|
eventName |
string |
onGMSMessageSent
|
触发自定义事件的名字 默认是onGMSMessageSent |
Returns:
data - 传入的data
- Type
- object
format(date, fmt) → {string}
- Source:
功能:当前时间
Parameters:
Name | Type | Description |
---|---|---|
date |
number | string | new Date()的实例化对象或毫秒的时间戳 |
fmt |
string | 规则 string “yyyy-MM-dd hh:mm:ss.S” y: 年、M:月、d:日、h:小时、m:分钟、s:秒、S:分秒 |
Returns:
-深拷贝对象或数组
- Type
- string
fuzzy_search(list, keywordopt, taskopt) → {array}
- Source:
功能:模糊搜索
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
list |
array | 目标对象 |
|
keyword |
string | number |
<optional> |
目标key值 |
task |
function |
<optional> |
如果需要解析的数组中成员是一组对象的话需要该条件解析 需要return该解析的条件 |
Returns:
- 满足条件的新数组, 如果不满足条件也会返回一个空数组
- Type
- array
generateAsyncRoutes(permissionList, AllRoutes, childrenopt) → {array}
- Source:
功能:动态路由重组真实路由
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
permissionList |
array | 请求来的规定路由数组 |
||
AllRoutes |
object | 本地项目的全部路由 |
||
children |
boolean |
<optional> |
false
|
是否是子路由 default is true [注:此方法在react等其他工程使用需要改变] |
Returns:
- 重组后的路由数组,使用后还需使用router.addroutes方法重新渲染路由对象
- Type
- array
get_browser() → {undefined}
- Source:
功能:查看当前使用浏览器名称
Parameters:
Type | Description |
---|---|
Any | 并不需要任何参数 |
Returns:
- 没有返回值,也可以理解为返回值为undefined
- Type
- undefined
get_client_height() → {Number}
- Source:
功能:获取可视窗口高度
Parameters:
Type | Description |
---|---|
Any | 并不需要任何参数 |
Returns:
- 可视窗口高度
- Type
- Number
get_data(dataObj, dataKey, redirectValueopt) → {Any}
- Source:
功能:读取复杂数据类型中是否存在当前key值以及参数
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
dataObj |
object | string | number | boolean | bigint | sybmol | array | 目标对象 |
|
dataKey |
string | 目标key值 |
|
redirectValue |
Any |
<optional> |
如果找不到当前key值的参数时返回指定默认值,如果不传递默认为空对象 |
Returns:
- 目标对象中指定查找的key值,如果没有找到或者值为undefined时返回 redirectValue 形参传递的数据
- Type
- Any
get_filter(data, callback) → {array}
- Source:
功能:过滤功能函数,对数组、字符串、对象进行过滤 当传入非规定类型数据时提示报错并且返回一个空数组以免页面出现基本问题
Parameters:
Name | Type | Description |
---|---|---|
data |
array | object | string | 目标数组、字符串、对象 |
callback |
function | 执行函数,对data参数进行处理的回调函数,需要对特殊条件进行return判断,该回调函数可以接受两个参数 1. item每一个成员;2.index 对应索引(或下标) |
Returns:
- 数组,如果没有满足执行函数return 值的函数规则时 返回空数组
- Type
- array
get_fromData(dataopt) → {FormData}
- Source:
功能:与后端交互时的FormData数据
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data |
object |
<optional> |
需要生成的formData对象需要传入一个普通对象 |
Returns:
- FormData
- Type
- FormData
get_network_type() → {Number|String}
- Source:
功能:查看当前使用网络
Parameters:
Type | Description |
---|---|
Any | 并不需要任何参数 |
Returns:
- 1:wifi, 2: 2g, 3: 3g & 3gnet, 4: 4g
- Type
- Number | String
get_os() → {String}
- Source:
功能:查看当前使用网络设备的系统型号
Parameters:
Type | Description |
---|---|
Any | 并不需要任何参数 |
Returns:
- Mac\Unix\Linux\Win2000\WinXP\Win2003\WinVista\Win7\Win10\Win11
- Type
- String
get_page_view_width() → {Number}
- Source:
功能:获取可视窗口宽度
Parameters:
Type | Description |
---|---|
Any | 并不需要任何参数 |
Returns:
- 可视窗口宽度
- Type
- Number
get_qrcode(urlopt, thenFunopt, catchFunopt) → {undefined}
- Source:
功能:读取字符,通过第三方组件库进行二维码生成
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
url |
string |
<optional> |
I am a pony!
|
需要生成图片的链接以及URL路径 |
thenFun |
function |
<optional> |
成功的回调函数 |
|
catchFun |
function |
<optional> |
失败的回调函数 |
Returns:
- undefined
- Type
- undefined
get_qs() → {Object}
- Source:
功能:一个查询字符串解析和字符串化库,增加了一些安全性
Parameters:
Type | Description |
---|---|
undefined | 不需要传递参数 |
Returns:
-
- parse恢复原样; 2. stringify转换为字符串;
- Type
- Object
getCache(key, type:) → {any}
- Source:
功能:获取缓存数据
Parameters:
Name | Type | Description |
---|---|---|
key |
string | |
type: |
string | 缓存类型 'local'(默认) / session; |
Returns:
'local'(默认) / session拿到的值
- Type
- any
getSubStr(str, number) → {string}
- Source:
功能:文字超出中间省略号
Parameters:
Name | Type | Default | Description |
---|---|---|---|
str |
string | 文字 |
|
number |
number |
4
|
如果str > number * 2 的截取值 |
Returns:
string
- Type
- string
handleDownloadFile(option, url-option, filename-option) → {undefined}
- Source:
功能:下载文件的方法
Parameters:
Name | Type | Description |
---|---|---|
option |
object | 配置对象 |
url-option |
string | 下载地址 |
filename-option |
string | 下载后的文件名 |
Returns:
undefined
- Type
- undefined
IdCodeValid(code) → {boolean}
- Source:
功能:身份证号合法性验证-支持15位和18位身份证号-支持地址编码、出生日期、校验位验证
Parameters:
Name | Type | Description |
---|---|---|
code |
object | 身份证号 |
Returns:
true | false
- Type
- boolean
is_device() → {String}
- Source:
功能:仅判断当前是否是iOS、Android、Web
Parameters:
Type | Description |
---|---|
Any | 并不需要任何参数 |
Returns:
- iOS、Android、Web
- Type
- String
is_email(target) → {Boolean}
- Source:
功能:仅判断当前是否是正确邮箱
Parameters:
Name | Type | Description |
---|---|---|
target |
String | 输入邮箱账号 |
Returns:
- 如果是正确的邮箱账号,会返回true反则会返回false
- Type
- Boolean
is_time(target, option) → {Boolean}
- Source:
功能:仅判断当前是否是正确格式的时间
Parameters:
Name | Type | Default | Description |
---|---|---|---|
target |
String | 输入时间字符串 |
|
option |
String |
:
|
查询字符 |
Returns:
- 如果是正确的时间规格,会返回true反则会返回false
- Type
- Boolean
is_wx() → {Boolean}
- Source:
功能:仅判断当前是否是微信
Parameters:
Type | Description |
---|---|
Any | 并不需要任何参数 |
Returns:
- 如果是微信浏览器,会返回true反则会返回false
- Type
- Boolean
isExternal(path) → {boolean}
- Source:
功能:判断是否是一个外部链接
Parameters:
Name | Type | Description |
---|---|---|
path |
string | url链接 |
Returns:
- true为是外部链接,false为内部链接
- Type
- boolean
md_5(data) → {string}
- Source:
功能:md5加密格式
Parameters:
Name | Type | Description |
---|---|---|
data |
string | 需要加密的数据 |
Returns:
- string
- Type
- string
nextTick(fn, mode) → {undefined}
- Source:
功能:nextTick
Parameters:
Name | Type | Description |
---|---|---|
fn |
function | callback回调函数 |
mode |
string | 触发开关 默认是promise |
Returns:
undefined
- Type
- undefined
numUtilsFnc(data, target) → {string}
- Source:
功能:金钱数据重组
Parameters:
Name | Type | Description |
---|---|---|
data |
string | 目标金钱字符串 |
target |
string | 重组后以什么分隔 |
Returns:
- 根据 target 参数整理好的新的金钱数据
- Type
- string
obj_arr_str_for(data, callback) → {array}
- Source:
功能:数组\对象\字符串进行循环操作
注意(1):当第一个参数传入【数组类型】的数据时正常使用 callback函数可接受形参【3】个参数 item:每一个成员;index:对应索引;arr:调用方法的原数组
注意(2):当第一个参数传入【对象类型】的数据时正常使用 callback函数可接受形参【2】个参数 arr:调用方法的原对象;key:每一个成员的key值
注意(3):当第一个参数传入【字符串类型】的数据时正常使用 callback函数可接受形参【3】个参数 item:每一个成员;index:对应索引;arr:调用方法的原字符串 且请注意需要进行return才能返回修改后字符串的值;【注】不会影响原字符串,会返回一组新的字符串
Parameters:
Name | Type | Description |
---|---|---|
data |
array | object | string | 目标数组、字符串、对象 |
callback |
function | 执行函数,对data参数进行处理的回调函数,需要对特殊条件进行return判断,该回调函数可以接受两个参数 1. item每一个成员;2.index 对应索引(或下标) |
Returns:
- 数组,如果没有满足执行函数return 值的函数规则时 返回空数组并报错
- Type
- array
random(min, max) → {Number|null}
- Source:
功能:根据上下范围生成随机数
Parameters:
Name | Type | Description |
---|---|---|
min |
Number | String | 最小值 |
max |
Number | String | 最大值 |
Returns:
- 正常返回number随机数 只能传递两个参数,如果多传递参数就会return null
- Type
- Number | null
remove_repetition(arr, taskopt) → {array|object}
- Source:
功能:数组去重 只针对数组进行去重 且可以对成员进行去重处理,默认不处理
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
arr |
array | object | 执行函数 |
|
task |
Object |
<optional> |
内部并没有严格使用该参数 后期会使用当前参数进行完善 |
Returns:
- 去重后的数组对象
- Type
- array | object
reverseObj(obj) → {object}
- Source:
功能:把对象的键值对翻转过来
Parameters:
Name | Type | Description |
---|---|---|
obj |
object |
Returns:
obj
- Type
- object
scroll_to_bottom() → {Any}
- Source:
功能:滚动到页面底部
Parameters:
Type | Description |
---|---|
Any | 并不需要任何参数 |
Returns:
- 没有任何返回值
- Type
- Any
scroll_to_top() → {Any}
- Source:
功能:滚动到页面顶部
Parameters:
Type | Description |
---|---|
Any | 并不需要任何参数 |
Returns:
- 没有任何返回值
- Type
- Any
setCache(key, value, type:) → {undefined}
- Source:
功能:写入缓存数据
Parameters:
Name | Type | Description |
---|---|---|
key |
string | |
value |
any | |
type: |
string | 缓存类型 'local'(默认) / session; |
Returns:
undefined
- Type
- undefined
smooth_scroll(element) → {Any}
- Source:
功能:滚动到指定元素区域
Parameters:
Name | Type | Description |
---|---|---|
element |
element | 指定css选择器 |
Returns:
- 没有任何返回值
- Type
- Any
throttle(callback, dayNumopt) → {undefined}
- Source:
功能:节流功能函数,对特殊事件进行节流操作,按照规定时间执行callback函数
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
callback |
function | 执行函数 |
||
dayNum |
number | string |
<optional> |
300
|
default is 300 延时时间 如果字符串isNaN后结果为true把dayNum重置为300 |
Returns:
- undefined
- Type
- undefined
to_full_screen() → {Any}
- Source:
功能:打开浏览器全屏
Parameters:
Type | Description |
---|---|
Any | 并不需要任何参数 |
Returns:
- 没有任何返回值
- Type
- Any
useGMSCallback(actions, eventName) → {object}
- Source:
功能:发布自定义事件
Parameters:
Name | Type | Default | Description |
---|---|---|---|
actions |
object | 目标对象,自定义事件发送的参数 |
|
eventName |
string |
onGMSMessageSent
|
触发自定义事件的名字 默认是onGMSMessageSent |
Returns:
removeEventListener - 触发该方法删除自定义事件
- Type
- object
uu_id() → {string}
- Source:
功能:生成不重复的唯一id
Parameters:
Type | Description |
---|---|
undefined | 不需要传递参数 |
Returns:
- string
- Type
- string
vue_router_push_replace(VueRouter, push_callbackopt, replace_callbackopt) → {undefined}
- Source:
功能: 重写vue的push和replace方法,并可以集中处理报错
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
VueRouter |
VueRouter | 需要传入vue的router-dom |
|
push_callback |
function |
<optional> |
已经重写的push方法,但是可以对失败函数做出单独处理,default is empty function |
replace_callback |
function |
<optional> |
已经重写的replace方法,但是可以对失败函数做出单独处理,default is empty function |
Returns:
- undefined
- Type
- undefined
watermark(root) → {Objecy}
- Source:
功能:生成页面水印功能
Parameters:
Name | Type | Description |
---|---|---|
root |
Objecy | watermark_id: 'wm_div_id', //水印总体的id watermark_prefix: 'mask_div_id', //小水印的id前缀 watermark_txt:"测试水印", //水印的内容 watermark_x:20, //水印起始位置x轴坐标 watermark_y:20, //水印起始位置Y轴坐标 watermark_rows:0, //水印行数 watermark_cols:0, //水印列数 watermark_x_space:100, //水印x轴间隔 watermark_y_space:50, //水印y轴间隔 watermark_font:'微软雅黑', //水印字体 watermark_color:'black', //水印字体颜色 watermark_fontsize:'18px', //水印字体大小 watermark_alpha:0.15, //水印透明度,要求设置在大于等于0.005 watermark_width:100, //水印宽度 watermark_height:100, //水印长度 watermark_angle:15, //水印倾斜度数 watermark_parent_width:0, //水印的总体宽度(默认值:body的scrollWidth和clientWidth的较大值) watermark_parent_height:0, //水印的总体高度(默认值:body的scrollHeight和clientHeight的较大值) watermark_parent_node:null //水印插件挂载的父元素element,不输入则默认挂在body上 |
Returns:
-
- init 初始化水印,添加load和resize事件; 2. load 手动加载水印; 3.remove 手动移除水印;
- Type
- Objecy