Comments (1)
这是一个奇怪的问题,分情况讨论吧
1、子应用如果发起的api是绝对地址:“http:xxxx.com/api/xxxx”,那么不管是子应用单独运行还是内嵌在主应用都是这个绝对地址
2、子应用如果发起的api是相对地址:“/api/xxxx”,那么子应用单独运行请求域名是子应用的,内嵌在无界微前端中,host 还是子应用的(子应用运行在 iframe 内,无界在 iframe 内设置了 base 标签来修正相对地址)
如果是情况 2 ,又想子应用内嵌在无界微前端中请求域名是主应用的,那么可以这样做:
a、子应用的 api 请求是 fetch ,可以自定义子应用的 fetch,强制修改 url = host 主应用 + url
b、子应用的 api 请求是 xhr ,那就只能修改子应用的代码,将 url = window.POWERED_BY_WUJIE ? host 主应用 + url : url 这样可以走主应用的域名
from wujie.
Related Issues (20)
- OffScreenCanvas无法使用自定义字体,Canvas和HTML可以应用自定义字体。 HOT 2
- 无界子应用集成@tiptap富文本,第二次打开子应用时,中文输入法输入'@',会连续出现两个(@@),window.getSelection()永远为None HOT 1
- 3层嵌套的情况下,不同UI框架,字体图标不显示问题 HOT 1
- ios中子应用白屏,没有报错,看现象子应用中对应的js文件没加载,安卓正常 HOT 3
- jquery开发的项目,集成到无界时,js和css文件资源加载自动被注释,导致页面错乱 HOT 1
- 路由后退无反应问题 HOT 6
- 子系统的静态资源无法加载 HOT 1
- 官方可否写一个集成jQuery那种老的项目的demo
- 官网卡死, 100%复现
- 我希望配置化无界子应用,不知道子应用路由是hash模式还是history模式, WujieVue中怎么判断是否要 /#/
- 复用主应用的css样式,子应用不生效问题
- 主子应用都是Angular,子应用在使用MutationObserver用作动画处理时,zone.js中的patchClass的get方法陷入死循环
- 主应用和子应用为用一个工程,子应用偶发白屏 HOT 2
- 子应用在CDN中引入了地图框架Cesium,加载子应用时报错DOMException: Failed to construct 'Worker': Script at 'http://localhost:9081/cdn/cesium/Workers/cesiumWorkerBootstrapper.js' cannot be accessed from origin 'http://localhost:8080'. HOT 1
- WujieReact loading props not work
- 移动端 safari 浏览器 通过手势侧滑返回会闪屏
- 主应用内添加子应用初始化启动浏览器控制台报错
- 子应用 CSS 文件重复加载
- 单例模式下,cssBeforeLoaders在首次加载时生效,切换页面再次回到子应用所在页面,cssBeforeLoaders添加的css代码消失
- 子应用内存增加之后,主应用页面崩溃,报错STATUS_INTEGER_DIVIDE_BY_ZERO
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wujie.