📝 correct faq (#2556)
This commit is contained in:
parent
63dd00c317
commit
f17b416722
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -720,14 +720,11 @@ router.beforeEach((to, from, next) => {
|
|||
|
||||
## 微应用之间如何跳转?
|
||||
|
||||
- 主应用和微应用都是 `hash` 模式,主应用根据 `hash` 来判断微应用,则不用考虑这个问题。
|
||||
|
||||
- 主应用根据 `path` 来判断微应用
|
||||
|
||||
`history` 模式的微应用之间的跳转,或者微应用跳主应用页面,直接使用微应用的路由实例是不行的,原因是微应用的路由实例跳转都基于路由的 `base`。有两种办法可以跳转:
|
||||
微应用之间的跳转,或者微应用跳主应用页面,直接使用微应用的路由实例是不行的,如 raact-router 的 Link 组件或 vue 的 router-link,原因是微应用的路由实例跳转都基于路由的 `base`。有这几种办法可以跳转:
|
||||
|
||||
1. `history.pushState()`:[mdn 用法介绍](https://developer.mozilla.org/zh-CN/docs/Web/API/History/pushState)
|
||||
2. 将主应用的路由实例通过 `props` 传给微应用,微应用这个路由实例跳转。
|
||||
2. 直接使用原生 a 标签写完整地址,如:`<a href="http://localhost:8080/app1">app1</a>`
|
||||
3. 修改 location href 跳转,如:`window.location.href = 'http://localhost:8080/app1'`
|
||||
|
||||
## 微应用文件更新之后,访问的还是旧版文件
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user