zhl-methods
v2.0.0
Published
JS 微信小程序 工具类
Readme
zhl-methods
JS 微信小程序 工具类
安装
npm i zhl-methods引入使用
import { isPhone } from 'zhl-methods/js'
isPhone(123)JS
手机号校验
- @example isPhone('15093676561') => true
- @param {value} 要校验的数据
- @returns {Boolean} true false 是 否
对象转 url 参数
- @example toUrlQuery({a:1}) => '?a=1'
- @param {value} 要转换的对象
- @returns {String} '?a=1'
对象转 url 参数
- @example numberToPrice(1234.12) => '1,234.12'
- @param {number} 要转换的数字
- @returns {String} '1,234.12'
保留两位小数
- @example setTwoDecimal(3.144) => '3.14'
- @param {number} 要保留两位小数的数字
- @param {isAdjust} 是否四舍五入
- @returns {String} '3.14'
微信小程序
获取导航栏高度
- @example getNavBarHeight() => 100
- @returns {number}
弹窗二次确认
- @example showModal(query,callback)
- @param {Function} callback
获取当前环境
- @example getEnv()
- @returns {string} release 线上 trial 测试 develop 开发
获取 appId
- @example getAppId()
- @returns {string}
获取底部安全距离
- @example getSafeBottom()
- @returns {string}
