解决办法main.ts添加以下代码即可
if (typeof crypto !== 'undefined' && !crypto.randomUUID) {
crypto.randomUUID = function (): `${string}-${string}-${string}-${string}-${string}` {
const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
const r = Math.random() * 16 | 0;
const v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(uuid)) {
throw new Error('Generated UUID does not match expected format');
}
return uuid as `${string}-${string}-${string}-${string}-${string}`;
};
}