|
|
|
@ -4,12 +4,13 @@
|
|
|
|
<el-scrollbar>
|
|
|
|
<el-scrollbar>
|
|
|
|
<el-menu
|
|
|
|
<el-menu
|
|
|
|
:default-active="route.path"
|
|
|
|
:default-active="route.path"
|
|
|
|
|
|
|
|
:default-openeds="openKeys"
|
|
|
|
active-text-color="#1890FF"
|
|
|
|
active-text-color="#1890FF"
|
|
|
|
background-color="#fff"
|
|
|
|
background-color="#fff"
|
|
|
|
text-color="#000"
|
|
|
|
text-color="#000"
|
|
|
|
router
|
|
|
|
router
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<template v-for="(item, index) in routes" :key="index">
|
|
|
|
<template v-for="(item, index) in routes" :key="item.path">
|
|
|
|
<el-sub-menu
|
|
|
|
<el-sub-menu
|
|
|
|
:index="'/' + item.path"
|
|
|
|
:index="'/' + item.path"
|
|
|
|
v-if="item.children && item.children.filter((el) => !el.meta.hide).length > 0"
|
|
|
|
v-if="item.children && item.children.filter((el) => !el.meta.hide).length > 0"
|
|
|
|
@ -20,7 +21,7 @@
|
|
|
|
<el-menu-item
|
|
|
|
<el-menu-item
|
|
|
|
v-for="(ele, idx) in item.children.filter((el) => !el.meta.hide)"
|
|
|
|
v-for="(ele, idx) in item.children.filter((el) => !el.meta.hide)"
|
|
|
|
:index="'/' + item.path + '/' + ele.path"
|
|
|
|
:index="'/' + item.path + '/' + ele.path"
|
|
|
|
:key="idx"
|
|
|
|
:key="ele.path"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
{{ ele.meta.title }}</el-menu-item
|
|
|
|
{{ ele.meta.title }}</el-menu-item
|
|
|
|
>
|
|
|
|
>
|
|
|
|
@ -42,6 +43,17 @@ const userStore = useUserStore()
|
|
|
|
const route = useRoute()
|
|
|
|
const route = useRoute()
|
|
|
|
|
|
|
|
|
|
|
|
const routes = userStore.routerList
|
|
|
|
const routes = userStore.routerList
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const openKeys = ref([])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
|
|
|
() => route.path,
|
|
|
|
|
|
|
|
(path) => {
|
|
|
|
|
|
|
|
const parent = '/' + path.split('/')[1]
|
|
|
|
|
|
|
|
openKeys.value = [parent]
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{ immediate: true },
|
|
|
|
|
|
|
|
)
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|