获取uuid简便方法
2020-05-09 本文已影响0人
浪浪山小妖_
export const getUuid = () => {
return 'xxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0,
v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
//输出32位字符串,设置xxx-xxxx...可以对应输出带"-"符号32位字符串
--by Affandi ⊙▽⊙