Browse Source

修复UnityAction没有接收消息

xujunjie 1 năm trước cách đây
mục cha
commit
29112de53d
1 tập tin đã thay đổi với 9 bổ sung0 xóa
  1. 9 0
      src/utils/utils.js

+ 9 - 0
src/utils/utils.js

@@ -144,6 +144,15 @@ export const UnityAction = {
     }
   },
 };
+if (window.vuplex) {
+  window.vuplex.addEventListener('message', e => {
+    console.log('============================getMessageForUnity============================');
+    const data = JSON.parse(e.data);
+    console.log(data);
+    UnityAction.emit(data.type, data.message);
+  });
+}
+
 export function getGlobalData(key) {
   let data;
   try {