Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

子应用router模块问题 #18

Open
jessjava opened this issue Apr 13, 2020 · 6 comments
Open

子应用router模块问题 #18

jessjava opened this issue Apr 13, 2020 · 6 comments

Comments

@jessjava
Copy link

子应用在main.js里面createRouter,
其他js模块,如何import这个router对象呢?
main.js里面不能再export Router,微前端模式下是需要在mount里面create,保证每次都是新的。

@hql7
Copy link
Owner

hql7 commented Apr 13, 2020 via email

@jessjava
Copy link
Author

可以单独文件写mount等生命周期函数,再导入mainjs 并导出 发自我的iPhone

在 2020年4月13日,19:44,Jess @.***> 写道:  子应用在main.js里面createRouter, 其他js模块,如何import这个router对象呢? main.js里面不能再export Router,微前端模式下是需要在mount里面create,保证每次都是新的。 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

会有循环依赖的问题的

@hql7
Copy link
Owner

hql7 commented Apr 14, 2020

@jessjava 可以用常规的,在routerjs里直接实例化,写在生命周期里是为了方便接受主应用传下来的routes,但是数据也可以通过多种方式传输,例如子应用的store甚至win上

@jessjava
Copy link
Author

@jessjava 可以用常规的,在routerjs里直接实例化,写在生命周期里是为了方便接受主应用传下来的routes,但是数据也可以通过多种方式传输,例如子应用的store甚至win上

在销毁的时候把router置为null是为了做什么?

@wangxueyou110
Copy link

楼主有解决吗

@jessjava
Copy link
Author

jessjava commented May 6, 2020

楼主有解决吗

没有呢,这个问题是我这有很多老项目,老项目的js模块使用了router实例,所以在main.js里面new的router实例,没办法给子应用全局用呢。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants