Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
micro-system
/
micro-portal
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5c740f5e
authored
Nov 12, 2020
by
冒粤蓉
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
improve menu
1 parent
121f9837
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
13 deletions
src/components/DesktopLeftSider/Sub/Menu.vue
src/components/DesktopRightSider/DesktopRightSider.vue
src/store/modules/menu.js
src/components/DesktopLeftSider/Sub/Menu.vue
View file @
5c740f5
...
@@ -113,6 +113,11 @@ export default {
...
@@ -113,6 +113,11 @@ export default {
return
path
&&
path
.
includes
(
'system'
)
?
path
:
'/noData'
;
return
path
&&
path
.
includes
(
'system'
)
?
path
:
'/noData'
;
}
}
// 存储面包屑
const
saveBreadCrumbFunc
=
(
data
)
=>
{
store
.
dispatch
(
'menu/setBreadCrumb'
,
data
);
}
// 点击三级菜单做存储
// 点击三级菜单做存储
const
subMenuClicked
=
(
thisItem
,
parentItem
,
item
)
=>
{
const
subMenuClicked
=
(
thisItem
,
parentItem
,
item
)
=>
{
let
showEmpty
=
false
;
let
showEmpty
=
false
;
...
@@ -140,7 +145,8 @@ export default {
...
@@ -140,7 +145,8 @@ export default {
active
:
true
,
active
:
true
,
}
}
};
};
localStorage
.
setItem
(
'breadCrumb'
,
JSON
.
stringify
(
state
.
curBreadCrumb
));
saveBreadCrumbFunc
(
state
.
curBreadCrumb
);
let
path
=
filterPath
(
thisOrigin
.
frontRoute
);
let
path
=
filterPath
(
thisOrigin
.
frontRoute
);
if
(
path
===
'/noData'
)
{
if
(
path
===
'/noData'
)
{
...
@@ -173,7 +179,7 @@ export default {
...
@@ -173,7 +179,7 @@ export default {
active
:
true
active
:
true
};
};
localStorage
.
setItem
(
'breadCrumb'
,
JSON
.
stringify
(
state
.
curBreadCrumb
)
);
saveBreadCrumbFunc
(
state
.
curBreadCrumb
);
path
=
filterPath
(
path
);
path
=
filterPath
(
path
);
if
(
path
===
'/noData'
)
{
if
(
path
===
'/noData'
)
{
...
@@ -260,8 +266,8 @@ export default {
...
@@ -260,8 +266,8 @@ export default {
// const getNewTree = getMenuTree(res.data, menuTreeLocalList)
// const getNewTree = getMenuTree(res.data, menuTreeLocalList)
state
.
menuList
=
resData
;
state
.
menuList
=
resData
;
// 初始化操作
// 初始化操作
const
firstParent
=
resData
[
0
].
origin
,
const
firstParent
=
resData
[
0
].
origin
?
resData
[
0
].
origin
:
{}
,
firstChildren
=
resData
[
0
].
children
[
0
].
origin
;
firstChildren
=
resData
[
0
].
children
.
length
>
0
?
resData
[
0
].
children
[
0
].
origin
:
{}
;
let
showEmpty
=
false
;
let
showEmpty
=
false
;
// 同步面包屑
// 同步面包屑
...
@@ -308,7 +314,8 @@ export default {
...
@@ -308,7 +314,8 @@ export default {
});
});
if
(
isInit
)
{
if
(
isInit
)
{
if
(
childrenPath
===
'/noData'
||
childrenPath
===
'/'
let
params
=
null
;
if
(
childrenPath
===
'/noData'
||
childrenPath
===
'/'
||
childrenPath
===
''
||
(
getCurNextChildren
&&
getCurNextChildren
.
path
===
'/noData'
)
||
(
getCurNextChildren
&&
getCurNextChildren
.
path
===
'/noData'
)
||
(
getCurNextChildren
&&
getCurNextChildren
.
path
===
'/'
))
{
||
(
getCurNextChildren
&&
getCurNextChildren
.
path
===
'/'
))
{
showEmpty
=
true
;
showEmpty
=
true
;
...
@@ -317,6 +324,7 @@ export default {
...
@@ -317,6 +324,7 @@ export default {
let
thisPath
=
childrenPath
;
let
thisPath
=
childrenPath
;
if
(
getCurNextChildren
)
{
if
(
getCurNextChildren
)
{
thisPath
=
getCurNextChildren
.
path
;
thisPath
=
getCurNextChildren
.
path
;
params
=
getCurNextChildren
.
params
?
getCurNextChildren
.
params
:
null
;
}
}
history
.
pushState
(
null
,
thisPath
,
thisPath
);
history
.
pushState
(
null
,
thisPath
,
thisPath
);
store
.
dispatch
(
'menu/setBreadCrumb'
,
state
.
curBreadCrumb
);
store
.
dispatch
(
'menu/setBreadCrumb'
,
state
.
curBreadCrumb
);
...
...
src/components/DesktopRightSider/DesktopRightSider.vue
View file @
5c740f5
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
:class=
"
{active: item.active, pointer: item.path}"
:class=
"
{active: item.active, pointer: item.path}"
v-for="(item, index) in breadCrumbList"
v-for="(item, index) in breadCrumbList"
:key="index"
:key="index"
@click="routerGo(item
.path || '
')">
@click="routerGo(item
, item.path || '/noData
')">
{{
item
.
name
}}
{{
item
.
name
}}
</a-breadcrumb-item>
</a-breadcrumb-item>
</a-breadcrumb>
</a-breadcrumb>
...
@@ -50,7 +50,7 @@ export default {
...
@@ -50,7 +50,7 @@ export default {
})
})
const
showEmpty
=
computed
(()
=>
{
const
showEmpty
=
computed
(()
=>
{
return
!
state
.
el_sub_innerH
||
store
.
getters
.
commonData
.
showEmpty
;
return
store
.
getters
.
commonData
.
showEmpty
||
!
state
.
el_sub_innerH
;
})
})
const
breadCrumbList
=
computed
(()
=>
{
const
breadCrumbList
=
computed
(()
=>
{
...
@@ -60,7 +60,7 @@ export default {
...
@@ -60,7 +60,7 @@ export default {
let
breadCrumbList
=
[];
let
breadCrumbList
=
[];
if
(
curParent
)
{
if
(
curParent
)
{
breadCrumbList
.
push
({
breadCrumbList
.
push
({
name
:
cur
Parent
.
menuName
+
' / '
name
:
cur
Children
.
menuName
?
curParent
.
menuName
+
' / '
:
curParent
.
menuName
});
});
}
}
if
(
curChildren
)
{
if
(
curChildren
)
{
...
@@ -68,7 +68,7 @@ export default {
...
@@ -68,7 +68,7 @@ export default {
breadCrumbList
.
push
({
breadCrumbList
.
push
({
name
:
nextChildren
?
curChildren
.
menuName
+
' / '
:
curChildren
.
menuName
,
name
:
nextChildren
?
curChildren
.
menuName
+
' / '
:
curChildren
.
menuName
,
path
:
curChildren
.
path
,
path
:
curChildren
.
path
,
active
:
curChildren
.
activ
e
active
:
nextChildren
?
false
:
tru
e
});
});
if
(
nextChildren
)
{
if
(
nextChildren
)
{
breadCrumbList
.
push
({
breadCrumbList
.
push
({
...
@@ -78,18 +78,46 @@ export default {
...
@@ -78,18 +78,46 @@ export default {
});
});
}
}
}
}
return
breadCrumbList
;
return
breadCrumbList
;
})
})
const
routerGo
=
(
path
)
=>
{
// history.pushState(null, path, path);
const
routerGo
=
(
item
,
path
)
=>
{
let
saveBreadCrumb
=
{};
const
thisName
=
item
.
name
.
replace
(
' / '
,
''
);
const
curBreadCrumb
=
store
.
getters
.
curBreadCrumb
,
curParent
=
curBreadCrumb
[
'parent'
],
curChildren
=
curBreadCrumb
[
'children'
];
if
(
thisName
===
curParent
.
menuName
)
{
saveBreadCrumb
.
parent
=
curParent
;
saveBreadCrumb
.
children
=
{};
return
false
;
}
if
(
curChildren
)
{
const
nextChildren
=
curChildren
.
children
;
if
(
thisName
===
curChildren
.
menuName
)
{
saveBreadCrumb
.
parent
=
curParent
;
if
(
nextChildren
)
{
delete
curChildren
.
children
;
}
saveBreadCrumb
.
children
=
curChildren
;
}
else
{
if
(
thisName
===
nextChildren
.
menuName
)
{
saveBreadCrumb
=
curBreadCrumb
;
}
}
}
store
.
dispatch
(
'menu/setBreadCrumb'
,
saveBreadCrumb
);
history
.
pushState
(
null
,
path
,
path
);
}
}
return
{
return
{
...
toRefs
(
state
),
breadCrumbList
,
breadCrumbList
,
elmSubMicro
,
elmSubMicro
,
showEmpty
showEmpty
,
//
routerGo
routerGo
}
}
}
}
}
}
...
...
src/store/modules/menu.js
View file @
5c740f5
...
@@ -29,6 +29,7 @@ export default {
...
@@ -29,6 +29,7 @@ export default {
// 设置面包屑
// 设置面包屑
SET_BREAD_CRUMB
(
state
,
data
)
{
SET_BREAD_CRUMB
(
state
,
data
)
{
state
.
curBreadCrumb
=
data
;
state
.
curBreadCrumb
=
data
;
localStorage
.
setItem
(
'breadCrumb'
,
JSON
.
stringify
(
data
));
},
},
// 子系统操作更新菜单
// 子系统操作更新菜单
UPDATE_MENU
(
state
,
data
)
{
UPDATE_MENU
(
state
,
data
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment