getRandomUUID

生成随机 UUID 字符串

用法

getRandomUUID 函数用于生成符合 UUID v4 格式的随机字符串。

import { getRandomUUID } from '@movk/core'

const id1 = getRandomUUID()
console.log(id1) // 'f47ac10b-58cc-4372-a567-0e02b2c3d479'

const id2 = getRandomUUID()
console.log(id2) // 'f47ac10b-58cc-4372-a567-0e02b2c3d480'

// 用于生成唯一标识符
const componentId = `component-${getRandomUUID()}`

API

getRandomUUID()

生成随机 UUID 字符串。

返回值

返回值
string
符合 UUID v4 格式的随机字符串。

Changelog

7c832 — refactor!: 重构模块架构,拆分 utils 为专业化模块

Copyright © 2024 - 2026 YiXuan - MIT License