【功能新增】IoT:产品详情,优化相关展示

This commit is contained in:
YunaiV
2024-12-07 20:17:00 +08:00
parent dc2dbcbc84
commit 48907bde60
5 changed files with 40 additions and 18 deletions

View File

@ -116,6 +116,20 @@ export function toAnyString() {
return str
}
/**
* 生成指定长度的随机字符串
*
* @param length 字符串长度
*/
export function generateRandomStr(length: number): string {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
let result = ''
for (let i = 0; i < length; i++) {
result += chars.charAt(Math.floor(Math.random() * chars.length))
}
return result
}
/**
* 首字母大写
*/