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

fix(qiankun): 运行时同时支持insert路径写入,以及嵌套路径两种写入方式 (#751) #770

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,14 @@ async function getMasterRuntime() {

// modify route with "microApp" attribute to use real component
function patchMicroAppRouteComponent(routes: IRouteProps[]) {
const { routeBindingAlias, base, masterHistoryType } = getMasterOptions() as MasterOptions;

const insertRoutes = microAppRuntimeRoutes.filter(r => r.insert);
// 先处理 insert 配置
insertRoutes.forEach(route => {
// 转化insert配置变更成 micro组件
patchMicroAppRoute(route, getMicroAppRouteComponent, { base, masterHistoryType, routeBindingAlias });
// 将转换后的micro组件,插入对应路由
insertRoute(routes, route);
});

Expand All @@ -51,7 +56,6 @@ function patchMicroAppRouteComponent(routes: IRouteProps[]) {

const rootRoutes = getRootRoutes(routes);
if (rootRoutes) {
const { routeBindingAlias, base, masterHistoryType } = getMasterOptions() as MasterOptions;
const microAppAttachedRoutes = microAppRuntimeRoutes.filter(r => !r.insert);
microAppAttachedRoutes.reverse().forEach(microAppRoute => {
const patchRoute = (route: IRouteProps) => {
Expand Down