exportfunctioncopyToBoard(value){
const element = document.createElement('textarea')
document.body.appendChild(element)
element.value = value
element.select()if(document.execCommand('copy')){
document.execCommand('copy')
document.body.removeChild(element)returntrue}
document.body.removeChild(element)returnfalse}
3. 生成随机字符串
exportfunctionuuid(length=8, chars='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'){
let result =''for(let i = length; i >0;--i)
result += chars[Math.floor(Math.random()* chars.length)]return result
}
exportfunctionuniqueArray(arr){
if(!Array.isArray(arr)){
thrownewError('The first parameter must be an array')}if(arr.length ==1){
return arr
}return[...newSet(arr)]}