13 lines
342 B
JavaScript
13 lines
342 B
JavaScript
export default {
|
|
methods: {
|
|
newUid (length) {
|
|
const uidLength = length || 16
|
|
const uidChars = 'abcdefghijklmnopqrstuvwxyz0123456789'
|
|
var uid = []
|
|
for (var i = 0; i < uidLength; i++) {
|
|
uid.push(uidChars.charAt(Math.floor(Math.random() * ((i < 4) ? 26 : 36))))
|
|
}
|
|
return uid.join('')
|
|
}
|
|
}
|
|
} |