Prechádzať zdrojové kódy

修复后端控制路由获取菜单树时path属性返回空值导致前端添加路由报错,并添加注释

yihua 2 rokov pred
rodič
commit
7c2abe540c
1 zmenil súbory, kde vykonal 1 pridanie a 1 odobranie
  1. 1 1
      Web/src/router/backEnd.ts

+ 1 - 1
Web/src/router/backEnd.ts

@@ -136,7 +136,7 @@ export async function setBackEndControlRefreshRoutes() {
 export function backEndComponent(routes: any) {
 export function backEndComponent(routes: any) {
 	if (!routes) return;
 	if (!routes) return;
 	return routes.map((item: any) => {
 	return routes.map((item: any) => {
-		if (item.path) item.path = "";
+		if (!item.path) item.path = ""; //此处是为了防止后端返回的路由没有path属性,导致路由报错
 		if (item.component) item.component = dynamicImport(dynamicViewsModules, item.component as string);
 		if (item.component) item.component = dynamicImport(dynamicViewsModules, item.component as string);
 		item.children && backEndComponent(item.children);
 		item.children && backEndComponent(item.children);
 		return item;
 		return item;