update
This commit is contained in:
parent
7643305054
commit
16121d7260
|
@ -240,17 +240,23 @@ const handleSubmit = async () => {
|
|||
popupRef.value?.close()
|
||||
emit('success')
|
||||
}
|
||||
const generateUuid = () => {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
const r = (Math.random() * 16) | 0
|
||||
const v = c == 'x' ? r : (r & 0x3) | 0x8
|
||||
return v.toString(16)
|
||||
})
|
||||
const generateUuid = (length: number) => {
|
||||
let result1='',result2='';
|
||||
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
||||
const characters1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
||||
result1 = characters.charAt(Math.floor(Math.random() * characters.length))
|
||||
for (let i = 0; i < length; i++) {
|
||||
const randomIndex = Math.floor(Math.random() * characters1.length);
|
||||
result2 += characters1.charAt(randomIndex);
|
||||
|
||||
}
|
||||
return result1+result2;
|
||||
}
|
||||
|
||||
//打开弹窗
|
||||
const open = (type = 'add') => {
|
||||
mode.value = type
|
||||
formData.code = generateUuid()
|
||||
formData.code = generateUuid(3)
|
||||
popupRef.value?.open()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue