fix 修复分栏布局bug

This commit is contained in:
yxh 2023-03-16 11:44:24 +08:00
parent b253e340e9
commit 268cda59aa
2 changed files with 37 additions and 15 deletions

View File

@ -102,7 +102,9 @@ export default defineComponent({
state.liOldPath = path;
state.liOldIndex = k;
state.liHoverIndex = k;
proxy.mittBus.emit('setSendColumnsChildren', setSendChildren(path));
if(v.children&&v.children.length>0){
proxy.mittBus.emit('setSendColumnsChildren', setSendChildren(v.children[0].path));
}
stores.setColumnsMenuHover(false);
stores.setColumnsNavHover(true);
};
@ -130,16 +132,21 @@ export default defineComponent({
};
//
const setSendChildren = (path: string) => {
const currentPathSplit = path.split('/');
let currentData: any = {};
state.columnsAsideList.map((v: any, k: number) => {
if (v.path === `/${currentPathSplit[1]}`) {
v['k'] = k;
currentData['item'] = [{ ...v }];
currentData['children'] = [{ ...v }];
if (v.children) currentData['children'] = v.children;
}
});
state.columnsAsideList.some((v:any,k:number)=>{
if(v.children){
v.children.some((sv:any)=>{
if(sv.path===path){
v['k'] = k;
currentData['item'] = [{ ...v }];
currentData['children'] = [{ ...v }];
if (v.children) currentData['children'] = v.children;
return true
}
})
}
return false
})
return currentData;
};
//
@ -154,11 +161,17 @@ export default defineComponent({
};
// tagsView columnsAsideList
const setColumnsMenuHighlight = (path: string) => {
state.routeSplit = path.split('/');
state.routeSplit.shift();
const routeFirst = `/${state.routeSplit[0]}`;
const currentSplitRoute = state.columnsAsideList.find((v: any) => v.path === routeFirst);
if (!currentSplitRoute) return false;
const currentSplitRoute = state.columnsAsideList.some((v:any)=>{
if(v.children){
v.children.some((sv:any)=>{
if(sv.path===path){
return true
}
})
}
return false
})
if (!currentSplitRoute) return false;
//
setTimeout(() => {
onColumnsAsideDown((<any>currentSplitRoute).k);

View File

@ -142,6 +142,15 @@ export function setBackEndControlRefreshRoutes() {
export function backEndComponent(routes: any) {
if (!routes) return;
return routes.map((item: any) => {
if(item.children&&item.children.length>0){
item.children.some((ci:any)=>{
if(!ci.meta.isHide){
item.redirect = ci
return true
}
return false
})
}
if (item.component) item.component = dynamicImport(dynamicViewsModules, item.component as string);
item.children && backEndComponent(item.children);
return item;