Skip to content
On this page

randomUUID

Definition:

js
/**
 * Generate a random UUID.
 * @returns A random UUID.
 * @description Generate a unique UUID using the current time and the Math.random() function.
 * The UUID consists of 32 hexadecimal characters and 4 hyphens.
*/

Demo

generated random UUID -> 0df78669-f969-4c4a-9ce9-3ff55d5e18ce

Usage Example

ts
import { ref } from 'vue'
import { generateUUID } from 'utils-snap-fn'

const randomUUID = ref(generateUUID())

Source Code

utils-snap-fn-docs