fix 修复分栏布局bug
This commit is contained in:
parent
b253e340e9
commit
268cda59aa
@ -102,7 +102,9 @@ export default defineComponent({
|
|||||||
state.liOldPath = path;
|
state.liOldPath = path;
|
||||||
state.liOldIndex = k;
|
state.liOldIndex = k;
|
||||||
state.liHoverIndex = 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.setColumnsMenuHover(false);
|
||||||
stores.setColumnsNavHover(true);
|
stores.setColumnsNavHover(true);
|
||||||
};
|
};
|
||||||
@ -130,16 +132,21 @@ export default defineComponent({
|
|||||||
};
|
};
|
||||||
// 传送当前子级数据到菜单中
|
// 传送当前子级数据到菜单中
|
||||||
const setSendChildren = (path: string) => {
|
const setSendChildren = (path: string) => {
|
||||||
const currentPathSplit = path.split('/');
|
|
||||||
let currentData: any = {};
|
let currentData: any = {};
|
||||||
state.columnsAsideList.map((v: any, k: number) => {
|
state.columnsAsideList.some((v:any,k:number)=>{
|
||||||
if (v.path === `/${currentPathSplit[1]}`) {
|
if(v.children){
|
||||||
v['k'] = k;
|
v.children.some((sv:any)=>{
|
||||||
currentData['item'] = [{ ...v }];
|
if(sv.path===path){
|
||||||
currentData['children'] = [{ ...v }];
|
v['k'] = k;
|
||||||
if (v.children) currentData['children'] = v.children;
|
currentData['item'] = [{ ...v }];
|
||||||
}
|
currentData['children'] = [{ ...v }];
|
||||||
});
|
if (v.children) currentData['children'] = v.children;
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
return currentData;
|
return currentData;
|
||||||
};
|
};
|
||||||
// 路由过滤递归函数
|
// 路由过滤递归函数
|
||||||
@ -154,11 +161,17 @@ export default defineComponent({
|
|||||||
};
|
};
|
||||||
// tagsView 点击时,根据路由查找下标 columnsAsideList,实现左侧菜单高亮
|
// tagsView 点击时,根据路由查找下标 columnsAsideList,实现左侧菜单高亮
|
||||||
const setColumnsMenuHighlight = (path: string) => {
|
const setColumnsMenuHighlight = (path: string) => {
|
||||||
state.routeSplit = path.split('/');
|
const currentSplitRoute = state.columnsAsideList.some((v:any)=>{
|
||||||
state.routeSplit.shift();
|
if(v.children){
|
||||||
const routeFirst = `/${state.routeSplit[0]}`;
|
v.children.some((sv:any)=>{
|
||||||
const currentSplitRoute = state.columnsAsideList.find((v: any) => v.path === routeFirst);
|
if(sv.path===path){
|
||||||
if (!currentSplitRoute) return false;
|
return true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
if (!currentSplitRoute) return false;
|
||||||
// 延迟拿值,防止取不到
|
// 延迟拿值,防止取不到
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
onColumnsAsideDown((<any>currentSplitRoute).k);
|
onColumnsAsideDown((<any>currentSplitRoute).k);
|
||||||
|
@ -142,6 +142,15 @@ export 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.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);
|
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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user