mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-12-20 10:55:43 +08:00
将唯一ID生成功能提取到单独的具模块中
This commit is contained in:
7
src/js/common/uuid.js
Normal file
7
src/js/common/uuid.js
Normal file
@@ -0,0 +1,7 @@
|
||||
export const getUniqueId = () => {
|
||||
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
||||
const r = (Math.random() * 16) | 0;
|
||||
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
||||
return v.toString(16);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user