Browse Source

修复`iframe`跨域情况下页面不显示的问题

mxd 3 years ago
parent
commit
e8db209913
1 changed files with 5 additions and 2 deletions
  1. 5 2
      magic-editor/src/console/src/App.vue

+ 5 - 2
magic-editor/src/console/src/App.vue

@@ -14,8 +14,11 @@ export default {
   },
   },
   data() {
   data() {
     let defaultConfig = {};
     let defaultConfig = {};
-    if (parent && parent.MAGIC_EDITOR_CONFIG) {
-      defaultConfig = {...parent.MAGIC_EDITOR_CONFIG};
+    try {
+      if (parent && parent.MAGIC_EDITOR_CONFIG) {
+        defaultConfig = {...parent.MAGIC_EDITOR_CONFIG};
+      }
+    } catch (ignored) {
     }
     }
     if (window.MAGIC_EDITOR_CONFIG) {
     if (window.MAGIC_EDITOR_CONFIG) {
       defaultConfig = {...defaultConfig, ...window.MAGIC_EDITOR_CONFIG}
       defaultConfig = {...defaultConfig, ...window.MAGIC_EDITOR_CONFIG}