我的是history模式,非常尴尬, 我进入了死循环
来源:5-4 微前端框架 - 路由拦截
慕村1546111
2021-07-15
export const patchRouter = (orginEvent, emitEvent) => {
return function () {
const e = new Event(emitEvent)
orginEvent.apple(this, arguments)
window.dispatchEvent(e)
}
}
export const rewriteRouter = () => {
window.history.pushState = patchRouter(window.history.pushState, ‘mic_push’)
window.history.replaceState = patchRouter(window.history.replaceState, ‘mic_replace’)
window.addEventListener(‘mic_push’, turnApp)
window.addEventListener(‘mic_replace’, turnApp)
}
import { setList } from './const/subApps’
import { rewriteRouter } from ‘./router/rewriteRouter’;
rewriteRouter()
export const registerApp = appList => {
setList(appList)
}
1回答
-
yancy
2021-07-15
应该是turnApp里的路由检测。history路由也可以,但是我们在部署的时候就得让运维同学做下处理。这个本地不好模拟
022021-07-15
相似问题