diff --git a/src/router/index.js b/src/router/index.js index 932df895..6ec6c657 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -402,8 +402,21 @@ function fnAddDynamicMenuRoutes(menuList = [], routes = []) { eval(s2) ); // URL支持{{ window.xxx }}占位符变量 if (isURL(URL)) { - route["path"] = route["name"] = `i-${menuList[i].id}`; - route["meta"]["iframeURL"] = URL; + if (menuList[i].children && menuList[i].children.length >= 1) { + let item = menuList[i].children.find( + (subMenu) => subMenu.url == menuList[i].url + ); + if (item) { + route["path"] = route["name"] = `i-${menuList[i].id}`; + route["redirect"] = `i-${item.id}`; + } else { + route["path"] = route["name"] = `i-${menuList[i].id}`; + route["meta"]["iframeURL"] = URL; + } + } else { + route["path"] = route["name"] = `i-${menuList[i].id}`; + route["meta"]["iframeURL"] = URL; + } } else { URL = URL.replace(/^\//, "").replace(/_/g, "-"); if (URL.startsWith("unopen")) {