简单几行 Javascript 代码生成 UUID

500 阅读1分钟
function uuid() {
  const temp_url = URL.createObjectURL(new Blob())
  const uuid = temp_url.toString() // blob:https://xxx.com/b250d159-e1b6-4a87-9002-885d90033be3
  URL.revokeObjectURL(temp_url)
  return uuid.substring(uuid.length - 36)
}