导航栏: 首页 评论列表

生成uuid随机字符串

默认分类 2023/06/16 21:37

生成uuid随机字符串:

export const getDeviceId = () => {
  if (!window['randDeviceId']) {
    window['randDeviceId'] =
      `${new Date().getTime().toString(32)}_` +
      `${Math.random().toString(32).substr(2, 6)}_` +
      `${Math.random().toString(32).substr(2, 6)}_` +
      `${Math.random().toString(32).substr(2, 6)}`;
  }
  return window['randDeviceId'];
};


>> 留言评论