UNPKG

antd-mobile-taro-ui

Version:

以antd-mobile为设计标准,基于taro框架的微信小程序组件库

36 lines (29 loc) 740 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.uuid = uuid; function uuid(len = 16, radix, number) { let str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; if (number) { str = '0123456789' + str; } const chars = str.split(''); const value = []; let i = 0; radix = radix || chars.length; if (len) { for (i = 0; i < len; i++) value[i] = chars[0 | Math.random() * radix]; } else { let r; value[8] = value[13] = value[18] = value[23] = '-'; value[14] = '4'; for (i = 0; i < 36; i++) { if (!value[i]) { r = 0 | Math.random() * 16; value[i] = chars[i === 19 ? r & 0x3 | 0x8 : r]; } } } return value.join(''); }