微信小程序如何生成唯一的随机数uuid?
网友回复
根目录下新建util.js
const wxuuid = function () {
var s = [];
var hexDigits = "0123456789abcdef";
for (var i = 0; i < 36; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
s[14] = "4"; // bits 12-15 of the time_hi_a...点击查看剩余70%


