Commit 6c66cc8d authored by AI-甘富林's avatar AI-甘富林

前端代码修复

parent b28e8fcb
/**
* 生成唯一 ID,兼容非 Secure Context 环境(如 HTTP 页面、旧浏览器)
* 优先使用 crypto.randomUUID(),不可用时回退到时间戳+随机数
*/
export function generateUUID(): string {
if (typeof crypto !== 'undefined' && 'randomUUID' in crypto) {
return crypto.randomUUID();
}
// Fallback: timestamp + random string
return `${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment