浏览代码

chore(utils): 添加延时函数

wangcong 3 月之前
父节点
当前提交
ece071318c
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      src/utils/index.ts

+ 6 - 0
src/utils/index.ts

@@ -102,6 +102,12 @@ export const addUnit = (val: number, unit: string = 'px'): string => {
   return val + unit;
 };
 
+export const waitTime = async (time: number = 100) => {
+  await new Promise((resolve) => {
+    setTimeout(resolve, time);
+  });
+};
+
 export const downloadBlob = (blob: Blob, name: string) => {
   const url = window.URL.createObjectURL(blob);
   const a = document.createElement('a');