From f17b41672216143710e90c4c417164095d1a6a99 Mon Sep 17 00:00:00 2001 From: Kuitos Date: Thu, 13 Jul 2023 18:59:41 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20correct=20faq=20(#2556)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/faq/README.md | 11 ++++------- docs/faq/README.zh.md | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/docs/faq/README.md b/docs/faq/README.md index 56cdfb498..19633bf54 100644 --- a/docs/faq/README.md +++ b/docs/faq/README.md @@ -713,14 +713,11 @@ router.beforeEach((to, from, next) => { ## How to jump between micro apps? --Both the main application and the micro application are in the `hash` mode. The main application judges the micro application based on the `hash`, so this issue is not considered. +It is not feasible to use the router instance of micro-application directly to jump between micro-applications or micro-applications to main application page, such as the `Link` component in react-router or router-link in vue, because the router instance jump of micro-applications is based on the 'base' of routes. There are such ways to jump: --The main application judges the micro application based on the `path` - -It is not possible to directly use the routing instance of the micro-application to jump between micro-applications in the `history` mode or to jump to the main application page. The reason is that the routing instance jumps of the micro-application are all based on the `base` of the route. There are two ways to jump: - -1. `history.pushState()`: [mdn usage introduction](https://developer.mozilla.org/zh-CN/docs/Web/API/History/pushState) -2. Pass the routing instance of the main application to the micro application through `props`, and the micro application will jump to this routing instance. +1. ` history. PushState () ` : [MDN usage introduction] (https://developer.mozilla.org/zh-CN/docs/Web/API/History/pushState) +2. Direct use of native a full address label, such as: ` < a href = "http://localhost:8080/app1" > app1 < / a > ` +3. Modify the location href jump, such as: ` window. The location. The href = 'http://localhost:8080/app1' ` ## After the microapp file is updated, the old version of the file is still accessed diff --git a/docs/faq/README.zh.md b/docs/faq/README.zh.md index 8dbb26c4a..0b67a4c97 100644 --- a/docs/faq/README.zh.md +++ b/docs/faq/README.zh.md @@ -720,14 +720,11 @@ router.beforeEach((to, from, next) => { ## 微应用之间如何跳转? -- 主应用和微应用都是 `hash` 模式,主应用根据 `hash` 来判断微应用,则不用考虑这个问题。 +微应用之间的跳转,或者微应用跳主应用页面,直接使用微应用的路由实例是不行的,如 raact-router 的 Link 组件或 vue 的 router-link,原因是微应用的路由实例跳转都基于路由的 `base`。有这几种办法可以跳转: -- 主应用根据 `path` 来判断微应用 - - `history` 模式的微应用之间的跳转,或者微应用跳主应用页面,直接使用微应用的路由实例是不行的,原因是微应用的路由实例跳转都基于路由的 `base`。有两种办法可以跳转: - - 1. `history.pushState()`:[mdn 用法介绍](https://developer.mozilla.org/zh-CN/docs/Web/API/History/pushState) - 2. 将主应用的路由实例通过 `props` 传给微应用,微应用这个路由实例跳转。 +1. `history.pushState()`:[mdn 用法介绍](https://developer.mozilla.org/zh-CN/docs/Web/API/History/pushState) +2. 直接使用原生 a 标签写完整地址,如:`app1` +3. 修改 location href 跳转,如:`window.location.href = 'http://localhost:8080/app1'` ## 微应用文件更新之后,访问的还是旧版文件