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)
- 多层嵌套 HOT 1
- 主应用、子应用均为Vue2,子应用引入使用bpmn-js生成流程图,在火狐浏览器下,主应用嵌入子应用时不显示流程图。 HOT 3
- wujievue2 为什么不导出startApp HOT 1
- 子应用不能监听自定义合成事件 HOT 5
- 微前端对于write不支持 HOT 1
- 微信h5使用wujie后,在子应用展示二维码,ios长按二维码无响应,无法实现保存,分享,转发等操作,安卓正常 HOT 2
- 子应用引用第三方cdn静态js资源,加载出现跨域问题 HOT 1
- 无界 保活模式 一段时间不操作页面 #子应用出现边框且页面卡死,而且WujieVue.bus.$emit也无法触达子应用。 HOT 12
- 官网demo,子应用字体在重新激活时加载重复,生成两个一模一样的style标签
- 孙子应用的自定义@font-face不生效
- 子应用弹窗显示不了图片,position:fixed;或者absolute的时候不能展示图片。都是用的vue2,双向绑定也没问题就是渲染的时候img表情的src是空的
- window.$wujie.location.href 跳转问题 HOT 1
- 子应用中Popconfirm的确认事件无法被正确触发 HOT 2
- 这个仓库还在维护吗 HOT 7
- 子应用中使用 document.documentElement.addEventListener('keydown', ()=>{}) 绑定事件不生效
- wujie中无法正常是用worker
- 子应用中鼠标事件获取offset的值是基于wujie-app,不是基于指定元素
- vue3什么时候可以作为基座
- 子应用偶现白屏,且无报错
- 子应用打包部署后,antd组件库样式问题
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.