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 87015294
authored
Oct 27, 2020
by
冒粤蓉
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
improve menu
1 parent
04d32577
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
133 additions
and
107 deletions
package-lock.json
src/components/DesktopLeftSider/Sub/Menu.vue
package-lock.json
View file @
8701529
{
{
"name"
:
"glsx-micro-manager"
,
"name"
:
"glsx-micro-manager
-portal
"
,
"version"
:
"0.1.0"
,
"version"
:
"0.1.0"
,
"lockfileVersion"
:
1
,
"lockfileVersion"
:
1
,
"requires"
:
true
,
"requires"
:
true
,
...
@@ -1720,16 +1720,6 @@
...
@@ -1720,16 +1720,6 @@
"integrity"
:
"sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo="
,
"integrity"
:
"sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo="
,
"dev"
:
true
"dev"
:
true
},
},
"ansi-styles"
:
{
"version"
:
"4.3.0"
,
"resolved"
:
"https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz"
,
"integrity"
:
"sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"color-convert"
:
"^2.0.1"
}
},
"cacache"
:
{
"cacache"
:
{
"version"
:
"13.0.1"
,
"version"
:
"13.0.1"
,
"resolved"
:
"https://registry.npm.taobao.org/cacache/download/cacache-13.0.1.tgz?cache=0&sync_timestamp=1594429684526&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcacache%2Fdownload%2Fcacache-13.0.1.tgz"
,
"resolved"
:
"https://registry.npm.taobao.org/cacache/download/cacache-13.0.1.tgz?cache=0&sync_timestamp=1594429684526&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcacache%2Fdownload%2Fcacache-13.0.1.tgz"
,
...
@@ -1756,34 +1746,6 @@
...
@@ -1756,34 +1746,6 @@
"unique-filename"
:
"^1.1.1"
"unique-filename"
:
"^1.1.1"
}
}
},
},
"chalk"
:
{
"version"
:
"4.1.0"
,
"resolved"
:
"https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz"
,
"integrity"
:
"sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"ansi-styles"
:
"^4.1.0"
,
"supports-color"
:
"^7.1.0"
}
},
"color-convert"
:
{
"version"
:
"2.0.1"
,
"resolved"
:
"https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz"
,
"integrity"
:
"sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"color-name"
:
"~1.1.4"
}
},
"color-name"
:
{
"version"
:
"1.1.4"
,
"resolved"
:
"https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz"
,
"integrity"
:
"sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
,
"dev"
:
true
,
"optional"
:
true
},
"find-cache-dir"
:
{
"find-cache-dir"
:
{
"version"
:
"3.3.1"
,
"version"
:
"3.3.1"
,
"resolved"
:
"https://registry.npm.taobao.org/find-cache-dir/download/find-cache-dir-3.3.1.tgz"
,
"resolved"
:
"https://registry.npm.taobao.org/find-cache-dir/download/find-cache-dir-3.3.1.tgz"
,
...
@@ -1805,25 +1767,6 @@
...
@@ -1805,25 +1767,6 @@
"path-exists"
:
"^4.0.0"
"path-exists"
:
"^4.0.0"
}
}
},
},
"has-flag"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz"
,
"integrity"
:
"sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
,
"dev"
:
true
,
"optional"
:
true
},
"loader-utils"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz"
,
"integrity"
:
"sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"big.js"
:
"^5.2.2"
,
"emojis-list"
:
"^3.0.0"
,
"json5"
:
"^2.1.2"
}
},
"locate-path"
:
{
"locate-path"
:
{
"version"
:
"5.0.0"
,
"version"
:
"5.0.0"
,
"resolved"
:
"https://registry.npm.taobao.org/locate-path/download/locate-path-5.0.0.tgz"
,
"resolved"
:
"https://registry.npm.taobao.org/locate-path/download/locate-path-5.0.0.tgz"
,
...
@@ -1888,16 +1831,6 @@
...
@@ -1888,16 +1831,6 @@
"minipass"
:
"^3.1.1"
"minipass"
:
"^3.1.1"
}
}
},
},
"supports-color"
:
{
"version"
:
"7.2.0"
,
"resolved"
:
"https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz"
,
"integrity"
:
"sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"has-flag"
:
"^4.0.0"
}
},
"terser-webpack-plugin"
:
{
"terser-webpack-plugin"
:
{
"version"
:
"2.3.8"
,
"version"
:
"2.3.8"
,
"resolved"
:
"https://registry.npm.taobao.org/terser-webpack-plugin/download/terser-webpack-plugin-2.3.8.tgz"
,
"resolved"
:
"https://registry.npm.taobao.org/terser-webpack-plugin/download/terser-webpack-plugin-2.3.8.tgz"
,
...
@@ -1914,18 +1847,6 @@
...
@@ -1914,18 +1847,6 @@
"terser"
:
"^4.6.12"
,
"terser"
:
"^4.6.12"
,
"webpack-sources"
:
"^1.4.3"
"webpack-sources"
:
"^1.4.3"
}
}
},
"vue-loader-v16"
:
{
"version"
:
"npm:vue-loader@16.0.0-beta.8"
,
"resolved"
:
"https://registry.npmjs.org/vue-loader/-/vue-loader-16.0.0-beta.8.tgz"
,
"integrity"
:
"sha512-oouKUQWWHbSihqSD7mhymGPX1OQ4hedzAHyvm8RdyHh6m3oIvoRF+NM45i/bhNOlo8jCnuJhaSUf/6oDjv978g=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"chalk"
:
"^4.1.0"
,
"hash-sum"
:
"^2.0.0"
,
"loader-utils"
:
"^2.0.0"
}
}
}
}
}
},
},
...
@@ -10948,6 +10869,87 @@
...
@@ -10948,6 +10869,87 @@
}
}
}
}
},
},
"vue-loader-v16"
:
{
"version"
:
"npm:vue-loader@16.0.0-beta.8"
,
"resolved"
:
"https://registry.npmjs.org/vue-loader/-/vue-loader-16.0.0-beta.8.tgz"
,
"integrity"
:
"sha512-oouKUQWWHbSihqSD7mhymGPX1OQ4hedzAHyvm8RdyHh6m3oIvoRF+NM45i/bhNOlo8jCnuJhaSUf/6oDjv978g=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"chalk"
:
"^4.1.0"
,
"hash-sum"
:
"^2.0.0"
,
"loader-utils"
:
"^2.0.0"
},
"dependencies"
:
{
"ansi-styles"
:
{
"version"
:
"4.3.0"
,
"resolved"
:
"https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz"
,
"integrity"
:
"sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"color-convert"
:
"^2.0.1"
}
},
"chalk"
:
{
"version"
:
"4.1.0"
,
"resolved"
:
"https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz"
,
"integrity"
:
"sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"ansi-styles"
:
"^4.1.0"
,
"supports-color"
:
"^7.1.0"
}
},
"color-convert"
:
{
"version"
:
"2.0.1"
,
"resolved"
:
"https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz"
,
"integrity"
:
"sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"color-name"
:
"~1.1.4"
}
},
"color-name"
:
{
"version"
:
"1.1.4"
,
"resolved"
:
"https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz"
,
"integrity"
:
"sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
,
"dev"
:
true
,
"optional"
:
true
},
"has-flag"
:
{
"version"
:
"4.0.0"
,
"resolved"
:
"https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz"
,
"integrity"
:
"sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
,
"dev"
:
true
,
"optional"
:
true
},
"loader-utils"
:
{
"version"
:
"2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz"
,
"integrity"
:
"sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"big.js"
:
"^5.2.2"
,
"emojis-list"
:
"^3.0.0"
,
"json5"
:
"^2.1.2"
}
},
"supports-color"
:
{
"version"
:
"7.2.0"
,
"resolved"
:
"https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz"
,
"integrity"
:
"sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="
,
"dev"
:
true
,
"optional"
:
true
,
"requires"
:
{
"has-flag"
:
"^4.0.0"
}
}
}
},
"vue-router"
:
{
"vue-router"
:
{
"version"
:
"4.0.0-beta.13"
,
"version"
:
"4.0.0-beta.13"
,
"resolved"
:
"https://registry.npm.taobao.org/vue-router/download/vue-router-4.0.0-beta.13.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-router%2Fdownload%2Fvue-router-4.0.0-beta.13.tgz"
,
"resolved"
:
"https://registry.npm.taobao.org/vue-router/download/vue-router-4.0.0-beta.13.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-router%2Fdownload%2Fvue-router-4.0.0-beta.13.tgz"
,
...
...
src/components/DesktopLeftSider/Sub/Menu.vue
View file @
8701529
<
template
>
<
template
>
<a-menu
class=
"menu"
<div>
ref=
"menuRef"
<ul
class=
"menu ant-menu-dark ant-menu-root ant-menu ant-menu-inline"
>
theme=
"dark"
<!-- ant-menu-submenu-active ant-menu-submenu-open ant-menu-submenu-selected -->
mode=
"inline"
<li
class=
"ant-menu-submenu ant-menu-submenu-inline"
v-model:selectedKeys=
"selectedKeys"
:class=
"
{'ant-menu-submenu-open': item.showSubList}"
v-model:openKeys=
"openKeys"
v-for="item in menuList"
>
:key="item.origin.menuNo"
<a-sub-menu
v-for=
"item in menuList"
:key=
"item.origin.menuNo"
@
titleClick=
"titleClick(item)"
>
@click="titleClick(item, $event)" >
<template
v-slot:title
>
<div
class=
"ant-menu-submenu-title"
style=
"padding-left: 24px;"
>
<span>
<img
v-if=
"item.origin.icon"
:src=
"item.origin.icon"
/>
<img
v-if=
"item.origin.icon"
:src=
"item.origin.icon"
/>
<UserOutlined
v-else
/>
<UserOutlined
v-else
/>
<span>
{{
item
.
origin
.
menuName
}}
</span>
<span>
{{
item
.
origin
.
menuName
}}
</span>
</span>
<i
class=
"ant-menu-submenu-arrow"
></i>
</
template
>
</div>
<a-menu-item
v-for=
"cItem in item.children"
:key=
"cItem.origin.menuNo"
@
click=
"cItemClick(cItem.origin.path || '', cItem)"
>
<!-- ant-menu-item-selected ant-menu-item-active -->
<!-- ant-motion-collapse-legacy ant-motion-collapse-legacy-active -->
<ul
class=
"ant-menu-sub ant-menu ant-menu-inline"
v-if=
"item.showSubList"
>
<li
class=
"ant-menu-item"
:class=
"
{'ant-menu-item-selected': cItem.subItemActive}"
style="padding-left: 48px;"
v-for="cItem in item.children"
:key="cItem.origin.menuNo"
@click.stop="cItemClick(cItem.origin.path || '', cItem)">
{{
cItem
.
origin
.
menuName
}}
{{
cItem
.
origin
.
menuName
}}
</a-menu-item>
</li>
</a-sub-menu>
</ul>
</a-menu>
</li>
</ul>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
...
@@ -27,7 +38,7 @@ import {
...
@@ -27,7 +38,7 @@ import {
TeamOutlined
,
TeamOutlined
,
FileOutlined
,
FileOutlined
,
}
from
'@ant-design/icons-vue'
;
}
from
'@ant-design/icons-vue'
;
import
{
reactive
,
toRefs
,
onMounted
,
computed
}
from
'vue'
;
import
{
reactive
,
toRefs
,
onMounted
,
computed
,
getCurrentInstance
}
from
'vue'
;
import
{
useStore
}
from
'vuex'
;
import
{
useStore
}
from
'vuex'
;
import
MenuService
from
'services/Menu'
;
import
MenuService
from
'services/Menu'
;
...
@@ -41,26 +52,36 @@ export default {
...
@@ -41,26 +52,36 @@ export default {
FileOutlined
,
FileOutlined
,
},
},
setup
(
props
,
context
)
{
setup
(
props
,
context
)
{
const
{
ctx
}
=
getCurrentInstance
();
const
store
=
useStore
();
const
store
=
useStore
();
const
state
=
reactive
({
const
state
=
reactive
({
openKeys
:
[],
menuList
:
[],
selectedKeys
:
[],
menuList
:
menuTreeLocalList
,
curMainTitle
:
''
,
curMainTitle
:
''
,
curBreadCrumb
:
{
curBreadCrumb
:
{
parent
:
{},
parent
:
{},
children
:
[]
children
:
[]
}
}
});
});
console
.
log
(
'ctx'
,
ctx
);
// 点击主菜单标题
// 点击主菜单标题
const
titleClick
=
(
item
)
=>
{
const
titleClick
=
(
item
,
e
)
=>
{
item
.
showSubList
=
!
item
.
showSubList
;
state
.
curMainTitle
=
item
.
origin
.
menuName
;
state
.
curMainTitle
=
item
.
origin
.
menuName
;
};
};
// 点击二级菜单标题
// 点击二级菜单标题
const
cItemClick
=
(
path
,
cItem
)
=>
{
const
cItemClick
=
(
path
,
cItem
)
=>
{
const
cOrigin
=
cItem
.
origin
;
const
cOrigin
=
cItem
.
origin
;
// 激活active类
state
.
menuList
.
forEach
(
ele
=>
{
const
children
=
ele
.
children
;
children
.
forEach
(
cEle
=>
{
cEle
.
subItemActive
=
false
;
})
})
cItem
.
subItemActive
=
true
;
state
.
curBreadCrumb
.
parent
[
'menuName'
]
=
state
.
curMainTitle
;
state
.
curBreadCrumb
.
parent
[
'menuName'
]
=
state
.
curMainTitle
;
state
.
curBreadCrumb
.
children
=
[{
state
.
curBreadCrumb
.
children
=
[{
menuName
:
cOrigin
.
menuName
,
menuName
:
cOrigin
.
menuName
,
...
@@ -125,10 +146,16 @@ export default {
...
@@ -125,10 +146,16 @@ export default {
const
getNewTree
=
getMenuTree
(
res
.
data
,
menuTreeLocalList
),
const
getNewTree
=
getMenuTree
(
res
.
data
,
menuTreeLocalList
),
firstParent
=
getNewTree
[
0
].
origin
,
firstParent
=
getNewTree
[
0
].
origin
,
firstChildren
=
getNewTree
[
0
].
children
[
0
].
origin
;
firstChildren
=
getNewTree
[
0
].
children
[
0
].
origin
;
console
.
log
(
getNewTree
);
getNewTree
.
forEach
(
item
=>
{
item
.
showSubList
=
false
;
item
.
children
.
forEach
(
cItem
=>
{
cItem
.
subItemActive
=
false
;
})
});
state
.
menuList
=
getNewTree
;
state
.
menuList
=
getNewTree
;
state
.
openKeys
=
[
firstParent
.
menuNo
];
// 同步面包屑
state
.
selectedKeys
=
[
firstChildren
.
menuNo
];
state
.
curBreadCrumb
.
parent
[
'menuName'
]
=
firstParent
.
menuName
;
state
.
curBreadCrumb
.
parent
[
'menuName'
]
=
firstParent
.
menuName
;
state
.
curBreadCrumb
.
children
.
push
({
state
.
curBreadCrumb
.
children
.
push
({
menuName
:
firstChildren
.
menuName
,
menuName
:
firstChildren
.
menuName
,
...
@@ -143,10 +170,7 @@ export default {
...
@@ -143,10 +170,7 @@ export default {
};
};
getServerTree
();
getServerTree
();
onMounted
(()
=>
{
onMounted
(()
=>
{
console
.
log
(
context
)
});
});
return
{
return
{
...
...
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