cloud-web-corejs 1.0.54-dev.779 → 1.0.54-dev.780
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -301,9 +301,16 @@ function getUrlParams(url) {
|
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
// 宿主态下归属子应用的菜单不生成本地组件路由(否则会遮住 /micro/appCode/* 通配路由),
|
|
304
|
-
// 由子应用经 qiankun 渲染;侧边栏 handleSidebarRoutes
|
|
304
|
+
// 由子应用经 qiankun 渲染;侧边栏 handleSidebarRoutes 仍保留全量。
|
|
305
|
+
// 例外(B):来源为 base 的包内组件本应用本地就有,resolveComponentPath 会解析成 @base/…,
|
|
306
|
+
// 此时不派发、本地渲染,省去为一个共享组件装载整个子应用。
|
|
305
307
|
function isDelegatedToSubApp(route) {
|
|
306
|
-
|
|
308
|
+
if (hostRegistryApps.length === 0) return false;
|
|
309
|
+
if (!resolveOwner(route, hostRegistryApps)) return false;
|
|
310
|
+
const localPath = resolveComponentPath(route, getOwnAppCode());
|
|
311
|
+
// 解析出本地组件路径(@base/views 或 @/views)→ 本地渲染,不派发
|
|
312
|
+
if (localPath && localPath.charAt(0) === "@") return false;
|
|
313
|
+
return true;
|
|
307
314
|
}
|
|
308
315
|
|
|
309
316
|
function handleMenuRoutes(routes) {
|
package/src/utils/menuAdapter.js
CHANGED
|
@@ -110,10 +110,11 @@ export function resolveOwner(menu, registry) {
|
|
|
110
110
|
/**
|
|
111
111
|
* 解析组件路径(type 0 普通菜单):
|
|
112
112
|
* - "@..." 存量旧写法:url 即组件路径,原样返回;
|
|
113
|
-
* - /micro
|
|
114
|
-
*
|
|
113
|
+
* - /micro/<appCode>/… 或 /micro_debug/<同>:剥掉归属两段后本地解析——条件是
|
|
114
|
+
* 归属自己,或来源为 base(/micro/<any>/base/… 是包内组件,任何引包应用本地都有,
|
|
115
|
+
* 不看归属直接本地渲染,省去为一个共享组件装载整个子应用);
|
|
115
116
|
* - 首段 base:转 @base/views 命名空间;
|
|
116
|
-
* - 其余原样(无前缀走渲染方 @/views
|
|
117
|
+
* - 其余原样(无前缀走渲染方 @/views;归属别家的私有页原样返回交子应用渲染)。
|
|
117
118
|
*/
|
|
118
119
|
export function resolveComponentPath(menu, rendererAppCode) {
|
|
119
120
|
const url = menu && menu.url != null ? String(menu.url) : "";
|
|
@@ -123,12 +124,15 @@ export function resolveComponentPath(menu, rendererAppCode) {
|
|
|
123
124
|
if (!seg) return url;
|
|
124
125
|
if (MICRO_SEGMENTS.indexOf(seg) >= 0) {
|
|
125
126
|
const owner = getOwnerSegment(url);
|
|
126
|
-
//
|
|
127
|
-
if (!owner || !rendererAppCode || owner !== rendererAppCode) return url;
|
|
128
|
-
// 单字段写法 /micro/appA/base/xx:剥掉归属两段后可能仍带 base 命名空间,递归解析一次
|
|
129
|
-
// (appCode 传空,不会把 /micro/appA/micro/appA/xx 连剥两轮)
|
|
127
|
+
// 剥掉归属两段 /micro/<owner>;剩余首段为 base 即"包内组件来源"
|
|
130
128
|
const rest = stripFirstSegment(stripFirstSegment(url));
|
|
131
|
-
|
|
129
|
+
const isBaseSource = getFirstSegment(rest) === BASE_SEGMENT;
|
|
130
|
+
// 归属自己、或来源 base(包内组件人人有)→ 本地解析;否则(归属别家的私有页)原样返回。
|
|
131
|
+
// 递归一次把 rest 里的 base 命名空间转 @base/views;appCode 传空避免连剥两轮。
|
|
132
|
+
if (isBaseSource || (owner && rendererAppCode && owner === rendererAppCode)) {
|
|
133
|
+
return rest ? resolveComponentPath({ url: rest }, "") : "";
|
|
134
|
+
}
|
|
135
|
+
return url;
|
|
132
136
|
}
|
|
133
137
|
if (seg === BASE_SEGMENT) {
|
|
134
138
|
const rest = stripFirstSegment(url);
|