DESKTOP-O04BTUJ\muzen 2 lat temu
rodzic
commit
c36cd0f7f5
1 zmienionych plików z 9 dodań i 8 usunięć
  1. 9 8
      src/mixin/index.js

+ 9 - 8
src/mixin/index.js

@@ -254,16 +254,17 @@ const platformMixin = {
   methods: {
     // 通过音频类型获取对应的平台
     getPlatform(e) {
-      this.platformOptions = []
-      audioType(e).then(res => {
-        if (res.code === 0) {
-          res.data.map(i => {
-            this.platformOptions.push({
+      return new Promise((resolve, reject) => {
+        audioType(e).then(res => {
+          if (res.code === 0) {
+            resolve(this.platformOptions = [], res.data.map(i => this.platformOptions.push({
               value: Number(i.id),
               label: i.name
-            })
-          })
-        }
+            })))
+          }
+        }).catch(err => {
+          reject()
+        })
       })
     }
   }