摘要: function random(leng: number = 6): string { let s = Math.random().toString(36).substring(2, leng + 2) if (s.length < leng) return s + random(leng - s. 阅读全文
posted @ 2024-12-02 14:27 技术探索者 阅读(28) 评论(0) 推荐(0)
摘要: function deepCopy2<T extends object>(object: T) { return new Promise<T>((resolve) => { const {port1, port2} = new MessageChannel(); port1.postMessage( 阅读全文
posted @ 2024-12-02 14:26 技术探索者 阅读(29) 评论(0) 推荐(0)
摘要: function copyText(txt: string) { return new Promise((resolve, reject) => { const domCopy = function () { const input = document.createElement('input') 阅读全文
posted @ 2024-12-02 14:24 技术探索者 阅读(83) 评论(0) 推荐(0)
摘要: function formatPrice(val: string | number, precision: number = 2) { if (typeof val 'string') { let num = parseFloat(val) if (isNaN(num) || num.toStrin 阅读全文
posted @ 2024-12-02 14:23 技术探索者 阅读(41) 评论(0) 推荐(0)