xpxtool
v0.0.1
Published
./index.js
Downloads
3
Readme
xpxtool
Front end tool library for xpx.
Install
You can get xpxtool via npm.
npm install xpxtool -D
Usage
存储数据
Storage
import * as xpxtool from 'xpxtool';
xpxtool.setSessionStorage('test', '123');
Develop
# dev
npm run dev
# build
npm run build
# documentation
npm run docs
# publish
npm run release
开发使用注释方法
|名称 |作用 |备注| |:-----: |:-----: |:-----:| |@param| 参数描述 |仅供类、接口、方法注释时使用。同一个注释块可同时出现多个param描述。| |@return |返回描述 |仅供方法注释时使用。除void方法外其它所有方法必须有一个return描述。| |@throws |异常描述 |零到多个。| |@exception |异常描述 |零到多个。| |@author |作者 |类和接口注释中必须有。可有零到多个。| |@version |版本描述 |类和接口注释中必须有。零或一个。| |@see |参考描述 |可有零到多个。| |@since |起始版本 |只有一个。| |@serial |序列化描述 |或@serialField或@serialData,可有多个| |@deprecated |废除标志 |最多一个。|
browser
|方法名 | 描述| |:-----: |:-----: | |getBrowserType| 返回浏览器信息|
common
|方法名 | 描述| |:-----: |:-----: | |checkPermission| 判断权限| |compatibleExist| 不存在返回 ——| |debounce| 去抖| |deepClone| 深拷贝,支持常见类型| |generateRndNum| 生成随机数| |generateUniqueNum| 根据时间生成唯一标志的数字| |handleParam| 删除对象里面value值为null或''的键值对|
class
|方法名 | 描述| |:-----: |:-----: | |addClass| 节点添加指定class| |hasClass| 判断节点是否有指定class| |removeClass| 节点删除指定class|
digitUppercase
|方法名 | 描述| |:-----: |:-----: | |digitUppercase| 现金额转大写|
exportXls
|方法名 | 描述| |:-----: |:-----: | |exportXls| blob数据导出| |downFile| blob数据excel下载|
math
|方法名 | 描述| |:-----: |:-----: | |addMath| 数字计算加法| |subMath| 数字计算减法| |mulMath| 数字计算乘法| |divMath| 数字计算除法| |floatFixed| 浮点数保留指定位|
query
|方法名 | 描述| |:-----: |:-----: | |stringfyQueryString| 对象序列化| |getQueryParam| 获取地址栏 ? 后面的参数|
regexp
|方法名 | 描述| |:-----: |:-----: | |isEmail| 判断是否为邮箱地址| |isIdCard| 判断是否为身份证号| |isPhoneNum| 判断是否为手机号| |isSpecialChar| 检查是否为特殊字符| |isRightBankCard| 验证银行卡号| |isRightCardDate| 验证信用卡有效期| |isRightSafeCode| 验证信用卡安全码| |getCheckPrice| 价格处理| |getCheckNumber| 数字处理| |keepDecimals| 价格向下取值保留2位小数| |regExpUtil| 正则|
scroll
|方法名 | 描述| |:-----: |:-----: | |getScrollTop| 获取滚动条距顶部的距离| |scrollTo| 设置滚动条距顶部的距离|
storage
|方法名 | 描述| |:-----: |:-----: | |setCookie| 设置 Cookie| |getCookie| 获取 Cookie| |delCookie| 删除 Cookie| |setSessionStorage| 存储数据到 sessionStorage| |getSessionStorage| 获取数据到 sessionStorage| |delSessionStorage| 删除数据 sessionStorage| |setLocalStorage| 存储数据到 localStorage| |getLocalStorage| 获取数据到 localStorage| |delLocalStorage| 删除数据 localStorage|
time
|方法名 | 描述| |:-----: |:-----: | |formatPassTime| 格式化${startTime}距现在的已过时间| |formatRemainTime| 格式化现在距${endTime}的剩余时间| |isLeapYear| 是否为闰年| |getMonthDays| 获取指定日期月份的总天数| |getChangeTime| 用于时间选择值转换| |getParseTime| 用于时间值格式化转换|
navigatorBridge
|方法名 | 描述| |:-----: |:-----: | |getUserAgent| ios注册bridge| |callHandler| ios注册bridge页面回调函数默认处理,实际使用callHandler,只限ios| |appBridge| 安卓/ios交互处理|