Explorar el Código

恢复删除代码

hongrunxia hace 11 meses
padre
commit
2c1cdbc3d0
Se han modificado 1 ficheros con 12 adiciones y 8 borrados
  1. 12 8
      src/qiankun/index.ts

+ 12 - 8
src/qiankun/index.ts

@@ -34,16 +34,20 @@ const mountMicroApp = (path, toPath?) => {
       if (toPath) {
         app['props']['data']['publicPath'] = toPath;
       }
-      debugger;
       activeApps[app['activeRule']] = loadMicroApp(app, {
         fetch(url, ...args) {
-          return window.fetch(url, {
-            ...args,
-            headers: {
-              'Access-Control-Allow-Origin': '*',
-              'Content-Type': 'text/html',
-            },
-          });
+          // 给指定的微应用 entry 开启跨域请求
+          if (url === 'http://1.1.1.3:89/cookie/flash.js') {
+            return window.fetch(url, {
+              ...args,
+              headers: {
+                'Access-Control-Allow-Origin': '*',
+              },
+              mode: 'cors',
+              credentials: 'include',
+            });
+          }
+          return window.fetch(url, ...args);
         },
       }); // 手动加载子应用
     }