经过排查发现,在Vue中,路径(path)是用来定义路由的,而不能直接写写外链,需要写以“/”开头的路径,该问题只会有在配置静态路由的时候才会出现,动态路由外链不存在此问题,问题主要原因是对未知参数考虑不全面导致的一个小BUG。
RuoYi-Vue3-master\src\router\index.js
{ component: Layout, name: "http://ruoyi.vip", path: "//http://ruoyi.vip", hidden: false, meta: { title: "若依官网", icon: "guide", noCache: false, link: "http://ruoyi.vip", } }
RuoYi-Vue3-master\src\layout\components\Sidebar\SidebarItem.vue
function resolvePath(routePath, routeQuery) { if (isExternal(routePath)) { return routePath } if (isExternal(props.basePath)) { return props.basePath } if (routeQuery) { let query = JSON.parse(routeQuery); return { path: getNormalPath(props.basePath + '/' + routePath), query: query } } // 加个if 判断 即可解决此问题。 if(props.basePath.includes("http","https")){ return getNormalPath(props.basePath + '/' + routePath).substring(1); } return getNormalPath(props.basePath + '/' + routePath) }
powered by kaifamiao