bill 1 year ago
parent
commit
f9e3fe637d
1 changed files with 6 additions and 1 deletions
  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> => {
     Loading.show()
     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
 }