方法
$3
* uuidv7
1.1.8 增加
生成随机的uuid值
$3
* moneyToChinese
数字金额转中文
> moneyToChinese(money, uppercase?);
* money - 金额, 整数最大支持15位, 小数支持两位, 但整数加小数最大16位数, 暂不支持负数
* uppercase - 是否为大写中文, 默认小写中文
``
ts
import { moneyToChinese } from 'iplugins';
moneyToChinese(0.1); // 一角
moneyToChinese(0.01); // 一分
moneyToChinese(0); // 零元整
moneyToChinese(101.22); // 一百零一元二角二分
moneyToChinese(101.22, true); // 壹佰零壹元贰角贰分
moneyToChinese(500_000); // 五十万元整
moneyToChinese(110_000_001); // 一亿一千万零一元整
moneyToChinese(999_999_999_999_999.9); // 九百九十九兆九千九百九十九亿九千九百九十九万九千九百九十九元九角
`
* numberSplit
数字分割, 会分割所有数字, 包裹多位小数的数
1.1.7: 当传入非数字相关内容时直接返回'0'
`
ts
import { numberSplit } from 'iplugins';
numberSplit('5123.'); // 5,123
numberSplit('12312.234'); // 12,312.234
numberSplit(1000.12); // 1,000.12
numberSplit(1000.123456); // 1,000.123,456
numberSplit(1000.123456); // 1,000.123,456
`
* moneySplit
金额分割, 只会分割小数点前的数字
`
ts
import { moneySplit } from 'iplugins';
moneySplit(1000.12); // 1,000.12
`
$3
* parseSearchParams
search参数转对象
`
ts
import { parseSearchParams } from 'iplugins';
parseSearchParams(window.location.search): Object;
`
$3
* base64ToFile
将 Base64 字符串转换为 File 对象
`
ts
base64ToFile(
/* Base64 编码的字符串,可以包含 data URI 前缀 @date 2025.07.21 Q /
base64String: string,
/* 生成的文件名 @date 2025.07.21 Q /
filename: string,
/* 文件的 MIME 类型 @date 2025.07.21 Q /
mimeType: string
): File;
`
* base64ToUint8Array
将 Base64 字符串转换为 Uint8Array
`
ts
base64ToUint8Array(base64: string): Uint8Array;
`
$3
* iTimestamp()
解析时间戳, 将时间戳解析成对应的时间格式并输出
`
ts
iTimestamp(timestamp: number | string | Date, format?: string): string | undefined
`
timestamp — 时间戳
format — 想要返回的时间格式, 默认: 'yyyy/mm/dd hh:mm:ss.ms'
* iSecondsToTime()
秒数转时间
`
ts
iSecondsToTime(num: number, format?: string): string
``
num — 要转换的秒数
format — 输出的时间格式, 默认'dd:hh:mm:ss'