bill 1 年之前
父节点
当前提交
f9e3fe637d
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/utils/loading.ts

+ 6 - 1
src/utils/loading.ts

@@ -6,7 +6,12 @@ import type { AsyncComponentLoader, Component } from 'vue'
 export const loadPack = <T, K extends (...args: any[]) => Promise<T>>(fn: K | Promise<T>): Promise<T> => {
 export const loadPack = <T, K extends (...args: any[]) => Promise<T>>(fn: K | Promise<T>): Promise<T> => {
     Loading.show()
     Loading.show()
     const ret = typeof fn === 'function' ? fn() : fn
     const ret = typeof fn === 'function' ? fn() : fn
-    ret.finally(() => Loading.hide())
+    if (ret.finally) {
+      ret.finally(() => Loading.hide())
+    } else {
+      ret.then(() => Loading.hide())
+      ret.catch(() => Loading.hide())
+    }
     return ret
     return ret
 }
 }