wl-micro-frontends
wl-micro-frontends copied to clipboard
子应用router模块问题
子应用在main.js里面createRouter, 其他js模块,如何import这个router对象呢? main.js里面不能再export Router,微前端模式下是需要在mount里面create,保证每次都是新的。
可以单独文件写mount等生命周期函数,再导入mainjs 并导出
发自我的iPhone
在 2020年4月13日,19:44,Jess [email protected] 写道:
子应用在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.
可以单独文件写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.
会有循环依赖的问题的
@jessjava 可以用常规的,在routerjs里直接实例化,写在生命周期里是为了方便接受主应用传下来的routes,但是数据也可以通过多种方式传输,例如子应用的store甚至win上
@jessjava 可以用常规的,在routerjs里直接实例化,写在生命周期里是为了方便接受主应用传下来的routes,但是数据也可以通过多种方式传输,例如子应用的store甚至win上
在销毁的时候把router置为null是为了做什么?
楼主有解决吗
楼主有解决吗
没有呢,这个问题是我这有很多老项目,老项目的js模块使用了router实例,所以在main.js里面new的router实例,没办法给子应用全局用呢。