refactor(menu): 外链/内嵌改为 type=E+component 统一判断

This commit is contained in:
Ray.Hao
2026-06-29 22:30:02 +08:00
parent eb713aeccc
commit c966764314
8 changed files with 3 additions and 3 deletions

View File

@@ -179,7 +179,7 @@ export default defineMock([
children: [ children: [
{ {
path: "apifox", path: "apifox",
component: null, component: "iframe",
name: "Apifox", name: "Apifox",
meta: { meta: {
title: "Apifox", title: "Apifox",
@@ -225,7 +225,6 @@ export default defineMock([
}, },
{ {
path: "https://juejin.cn/post/7228990409909108793", path: "https://juejin.cn/post/7228990409909108793",
name: "ext-30",
meta: { meta: {
title: "平台文档(外链)", title: "平台文档(外链)",
type: "E", type: "E",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 487 KiB

After

Width:  |  Height:  |  Size: 504 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 609 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 115 KiB

View File

@@ -775,17 +775,18 @@ function normalizeMenuPayload(): MenuForm {
} }
if (payload.type === MenuTypeEnum.EXTERNAL) { if (payload.type === MenuTypeEnum.EXTERNAL) {
payload.component = undefined;
payload.perm = undefined; payload.perm = undefined;
payload.redirect = undefined; payload.redirect = undefined;
payload.alwaysShow = undefined; payload.alwaysShow = undefined;
payload.params = []; payload.params = [];
if (!payload.component) { if (!payload.component) {
// 新标签页:不需要路由名称、路径、缓存
payload.routeName = undefined; payload.routeName = undefined;
payload.routePath = undefined; payload.routePath = undefined;
payload.keepAlive = undefined; payload.keepAlive = undefined;
} else if (!isStatusEnabled(payload.keepAlive)) { } else if (!isStatusEnabled(payload.keepAlive)) {
// 内嵌但未开启缓存:不需要路由名称
payload.routeName = undefined; payload.routeName = undefined;
} }
} }