diff --git a/docs/faq/README.md b/docs/faq/README.md index bbf981c..fa4aede 100644 --- a/docs/faq/README.md +++ b/docs/faq/README.md @@ -265,3 +265,9 @@ qiankun will convert the dynamic script loading of the subapplication (such as J In singular mode, you can use the `excludeAssetFilter` parameter to release this part of the resource request, but note that the resources released by this option will escape the sandbox, and the resulting side effects need to be handled by you. If you use JSONP in not-singular mode, simply using `excludeAssetFilter` does not achieve good results, because each application is isolated by the sandbox; you can provide a unified JSONP tool in the main application, and the subapplication just calls the tool. + +## 404 after refresh of child application? +It is usually because you are routing in Browser mode, which requires the server to open it. +Specific configuration mode reference: +* [HTML5 History Mode](https://router.vuejs.org/guide/essentials/history-mode.html) +* [browserRouter](https://reactrouter.com/web/api/BrowserRouter) diff --git a/docs/faq/README.zh.md b/docs/faq/README.zh.md index 81fa67f..54641dd 100644 --- a/docs/faq/README.zh.md +++ b/docs/faq/README.zh.md @@ -328,10 +328,16 @@ const render = ($) => { 同时,你也需要开启相关资源的 CORS,具体请参照[此处](#微应用静态资源一定要支持跨域吗?) -## 子应用 JSONP 跨域错误怎么处理? +## 微应用 JSONP 跨域错误怎么处理? -qiankun 会将子应用的动态 script 加载(例如 JSONP)转化为 fetch 请求,因此需要相应的后端服务支持跨域,否则会导致错误。 +qiankun 会将微应用的动态 script 加载(例如 JSONP)转化为 fetch 请求,因此需要相应的后端服务支持跨域,否则会导致错误。 在单实例模式下,你可以使用 `excludeAssetFilter` 参数来放行这部分资源请求,但是注意,被该选项放行的资源会逃逸出沙箱,由此带来的副作用需要你自行处理。 若在多实例模式下使用 JSONP,单纯使用 `excludeAssetFilter` 并不能取得好的效果,因为各应用被沙箱所隔离;你可以在主应用提供统一的 JSONP 工具,子应用调用主应用提供的该工具来曲线救国。 + +## 微应用路径下刷新后 404? +通常是因为你使用的是 browser 模式的路由,这种路由模式的开启需要服务端配合才行。 +具体配置方式参考: +* [HTML5 History 模式](https://router.vuejs.org/zh/guide/essentials/history-mode.html) +* [browserHistory](https://react-guide.github.io/react-router-cn/docs/guides/basics/Histories.html#browserHistory)