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 4f3b21dc
authored
Oct 30, 2020
by
冒粤蓉
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
improve vuex store
1 parent
31ea7ba0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
12 deletions
src/components/DesktopLeftSider/Sub/Menu.vue
src/store/modules/app.js
src/store/modules/menu.js
src/components/DesktopLeftSider/Sub/Menu.vue
View file @
4f3b21d
...
@@ -165,11 +165,16 @@ export default {
...
@@ -165,11 +165,16 @@ export default {
state
.
menuList
=
getNewTree
;
state
.
menuList
=
getNewTree
;
// 同步面包屑
// 同步面包屑
const
getBreadCrumb
=
JSON
.
parse
(
localStorage
.
getItem
(
'breadCrumb'
));
// const getBreadCrumb = JSON.parse(localStorage.getItem('breadCrumb'));
const
breadChildren
=
getBreadCrumb
?
getBreadCrumb
.
children
[
0
]
:
''
;
// const breadChildren = getBreadCrumb ? getBreadCrumb.children[0] : '';
// let parentMenuName = getBreadCrumb ? getBreadCrumb.parent.menuName : firstParent.menuName,
// childrenMenuName = breadChildren.menuName || firstChildren.menuName,
// childrenPath = breadChildren.path || firstChildren.menuName || '';
const
getBreadCrumb
=
store
.
getters
.
curBreadCrumb
;
const
breadChildren
=
getBreadCrumb
?
getBreadCrumb
.
children
[
0
]
:
firstChildren
;
let
parentMenuName
=
getBreadCrumb
?
getBreadCrumb
.
parent
.
menuName
:
firstParent
.
menuName
,
let
parentMenuName
=
getBreadCrumb
?
getBreadCrumb
.
parent
.
menuName
:
firstParent
.
menuName
,
childrenMenuName
=
breadChildren
.
menuName
||
firstChildren
.
menuName
,
childrenMenuName
=
breadChildren
.
menuName
,
childrenPath
=
breadChildren
.
path
||
firstChildren
.
menuName
||
''
;
childrenPath
=
breadChildren
.
path
||
firstChildren
.
path
||
''
;
state
.
curBreadCrumb
.
parent
[
'menuName'
]
=
parentMenuName
;
state
.
curBreadCrumb
.
parent
[
'menuName'
]
=
parentMenuName
;
state
.
curBreadCrumb
.
children
.
push
({
state
.
curBreadCrumb
.
children
.
push
({
menuName
:
childrenMenuName
,
menuName
:
childrenMenuName
,
...
...
src/store/modules/app.js
View file @
4f3b21d
export
default
{
let
state
=
{
namespaced
:
true
,
state
:
{
baseURL
:
''
,
baseURL
:
''
,
size
:
10
,
// 分页 页大小
size
:
10
,
// 分页 页大小
token
:
''
,
token
:
''
,
...
@@ -10,7 +8,20 @@ export default {
...
@@ -10,7 +8,20 @@ export default {
commonData
:
{
commonData
:
{
showEmpty
:
false
showEmpty
:
false
}
}
},
};
try
{
const
userInfoStorage
=
localStorage
.
getItem
(
'userInfo'
);
if
(
userInfoStorage
)
{
state
.
userInfo
=
JSON
.
parse
(
userInfoStorage
);
}
}
catch
(
error
)
{
}
export
default
{
namespaced
:
true
,
state
,
mutations
:
{
mutations
:
{
SET_BASE_URL
(
state
,
data
)
{
SET_BASE_URL
(
state
,
data
)
{
state
.
baseURL
=
data
;
state
.
baseURL
=
data
;
...
...
src/store/modules/menu.js
View file @
4f3b21d
export
default
{
let
state
=
{
namespaced
:
true
,
state
:
{
is_collapse
:
false
,
// 折叠状态
is_collapse
:
false
,
// 折叠状态
menu
:
[],
// 菜单数据
menu
:
[],
// 菜单数据
curBreadCrumb
:
{}
curBreadCrumb
:
{}
},
};
try
{
const
breadCrumbStorage
=
localStorage
.
getItem
(
'breadCrumb'
);
if
(
breadCrumbStorage
)
{
state
.
curBreadCrumb
=
JSON
.
parse
(
breadCrumbStorage
);
}
}
catch
(
error
)
{
}
export
default
{
namespaced
:
true
,
state
,
mutations
:
{
mutations
:
{
// 推入用户菜单
// 推入用户菜单
ADD_USER_MENU
(
state
,
data
)
{
ADD_USER_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