1
0
forked from dyf/APP

优化设备控制,提交后,实时获取设备返回状态信息

This commit is contained in:
fengerli
2025-08-14 13:46:57 +08:00
parent d8edb9f31e
commit e56bbfe674
15 changed files with 1104 additions and 383 deletions

16
utils/function.js Normal file
View File

@ -0,0 +1,16 @@
/**
* 生成短ID (16位字符)
*/
export const generateShortId = () => {
const crypto = window.crypto || window.msCrypto;
if (crypto?.getRandomValues) {
return Array.from(crypto.getRandomValues(new Uint32Array(3)))
.map(n => n.toString(36))
.join('')
.slice(0, 16);
}
return Date.now().toString(36) + Math.random().toString(36).substr(2, 8);
};
export default generateShortId;