前端生成uuid

github下载地址: https://github.com/uuidjs/uuid

1. Install

npm install uuid

2. Create a UUID (ES6 module syntax)

import { v4 as uuidv4 } from 'uuid';
uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'

... or using CommonJS syntax:

const { v4: uuidv4 } = require('uuid');
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'

 

posted @ 2021-04-23 11:31  front-gl  阅读(515)  评论(0编辑  收藏  举报