🎨侧边栏优化
This commit is contained in:
parent
9bd6f19581
commit
a1845585a6
@ -5,6 +5,7 @@
|
|||||||
<el-menu-item :index="resolvePath(onlyOneChild.path)">
|
<el-menu-item :index="resolvePath(onlyOneChild.path)">
|
||||||
<svg-icon :name="onlyOneChild.meta.icon || (item.meta && item.meta.icon)" />
|
<svg-icon :name="onlyOneChild.meta.icon || (item.meta && item.meta.icon)" />
|
||||||
|
|
||||||
|
<span v-if="props.isCollapse && !onlyOneChild.meta.icon">{{ hasTitle2(onlyOneChild.meta.title) }}</span>
|
||||||
<template v-if="onlyOneChild.meta.titleKey" #title>
|
<template v-if="onlyOneChild.meta.titleKey" #title>
|
||||||
{{ $t(onlyOneChild.meta.titleKey) }}
|
{{ $t(onlyOneChild.meta.titleKey) }}
|
||||||
</template>
|
</template>
|
||||||
@ -45,6 +46,10 @@ const props = defineProps({
|
|||||||
basePath: {
|
basePath: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
},
|
||||||
|
isCollapse: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -102,4 +107,12 @@ function hasTitle(title) {
|
|||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hasTitle2(title) {
|
||||||
|
if (title.length >= 1) {
|
||||||
|
return title.charAt(0) + '...'
|
||||||
|
} else {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -11,7 +11,12 @@
|
|||||||
:collapse-transition="false"
|
:collapse-transition="false"
|
||||||
background-color="transparent"
|
background-color="transparent"
|
||||||
mode="vertical">
|
mode="vertical">
|
||||||
<sidebar-item v-for="(route, index) in sidebarRouters" :key="route.path + index" :item="route" :base-path="route.path" />
|
<sidebar-item
|
||||||
|
v-for="(route, index) in sidebarRouters"
|
||||||
|
:key="route.path + index"
|
||||||
|
:item="route"
|
||||||
|
:base-path="route.path"
|
||||||
|
:isCollapse="isCollapse" />
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</el-aside>
|
</el-aside>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user