https://www.npmjs.com/package/nanoid
体积更小,可以自定义字符集
<script setup>
import { onMounted } from 'vue'
import { nanoid, customAlphabet } from 'nanoid'
onMounted(() => {
let id1 = nanoid()
console.log(id1)
let customNanoid = customAlphabet('1234567890', 5)
let id2 = customNanoid()
console.log(id2)
})
</script>
<template>
<div>
</div>
</template>
人工智能学习网站
标签:npm,自定义,onMounted,id2,nanoid,customNanoid,let,下载量 From: https://blog.csdn.net/xutongbao/article/details/140132150