style: simplify sidebar css
This commit is contained in:
parent
d8ab55fe2a
commit
c6225b3cf7
@ -7,16 +7,12 @@ import path from "path-browserify"
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
item: RouteRecordRaw
|
item: RouteRecordRaw
|
||||||
isCollapse?: boolean
|
|
||||||
isTop?: boolean
|
isTop?: boolean
|
||||||
isFirstLevel?: boolean
|
|
||||||
basePath?: string
|
basePath?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
isCollapse: false,
|
|
||||||
isTop: false,
|
isTop: false,
|
||||||
isFirstLevel: true,
|
|
||||||
basePath: ""
|
basePath: ""
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -60,7 +56,6 @@ const resolvePath = (routePath: string) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div :class="{ 'simple-mode': props.isCollapse && !isTop, 'first-level': props.isFirstLevel }">
|
|
||||||
<template v-if="!alwaysShowRootMenu && theOnlyOneChild && !theOnlyOneChild.children">
|
<template v-if="!alwaysShowRootMenu && theOnlyOneChild && !theOnlyOneChild.children">
|
||||||
<SidebarItemLink v-if="theOnlyOneChild.meta" :to="resolvePath(theOnlyOneChild.path)">
|
<SidebarItemLink v-if="theOnlyOneChild.meta" :to="resolvePath(theOnlyOneChild.path)">
|
||||||
<el-menu-item :index="resolvePath(theOnlyOneChild.path)">
|
<el-menu-item :index="resolvePath(theOnlyOneChild.path)">
|
||||||
@ -83,13 +78,10 @@ const resolvePath = (routePath: string) => {
|
|||||||
v-for="child in showingChildren"
|
v-for="child in showingChildren"
|
||||||
:key="child.path"
|
:key="child.path"
|
||||||
:item="child"
|
:item="child"
|
||||||
:is-collapse="props.isCollapse"
|
|
||||||
:is-first-level="false"
|
|
||||||
:base-path="resolvePath(child.path)"
|
:base-path="resolvePath(child.path)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-sub-menu>
|
</el-sub-menu>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@ -104,17 +96,4 @@ const resolvePath = (routePath: string) => {
|
|||||||
margin-right: 12px;
|
margin-right: 12px;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.simple-mode {
|
|
||||||
&.first-level {
|
|
||||||
:deep(.el-sub-menu) {
|
|
||||||
.el-sub-menu__icon-arrow {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
span {
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -68,7 +68,6 @@ const hiddenScrollbarVerticalBar = computed(() => {
|
|||||||
:key="route.path"
|
:key="route.path"
|
||||||
:item="route"
|
:item="route"
|
||||||
:base-path="route.path"
|
:base-path="route.path"
|
||||||
:is-collapse="isCollapse"
|
|
||||||
:is-top="isTop"
|
:is-top="isTop"
|
||||||
/>
|
/>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user