Browse Source

优化节拍器生成异常 抛出错误

黄琪勇 11 tháng trước cách đây
mục cha
commit
65b5048a52
1 tập tin đã thay đổi với 22 bổ sung8 xóa
  1. 22 8
      src/page-instrument/view-detail/index.tsx

+ 22 - 8
src/page-instrument/view-detail/index.tsx

@@ -182,6 +182,17 @@ export default defineComponent({
         console.error(err)
         state.isLoading = false;
         isEmptyMusicShow.value = true
+        // 需要向外面(iframe)派发计时器数据的时候触发
+        if(query.isbeatTimes){
+          console.log("webApi_beatTimes",err)
+          window.parent.postMessage(
+            {
+              api: "webApi_beatTimes",
+              data: "节拍器时值错误!!"
+            },
+            "*"
+          );
+        }
         return
       }
       detailData.isLoading = false;
@@ -313,14 +324,17 @@ export default defineComponent({
       try{
         handleRendered(osmd)
       }catch(err:any){
-        console.log("webApi_beatTimes",err)
-        window.parent.postMessage(
-          {
-            api: "webApi_beatTimes",
-            data: "节拍器时值错误!!"
-          },
-          "*"
-        );
+        // 需要向外面(iframe)派发计时器数据的时候触发
+        if(query.isbeatTimes){
+          console.log("webApi_beatTimes",err)
+          window.parent.postMessage(
+            {
+              api: "webApi_beatTimes",
+              data: "节拍器时值错误!!"
+            },
+            "*"
+          );
+        }
       }
     }
     /** 指法配置 */