mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +08:00
Bugreport918 vertical spacing in side menu (#926)
* fixed vertical spacing issue in firefox * removed unnecessary important tag from css * bugfix - sidebar only shows icons if collapsed * fixed styling for hover sidebar * removed unnecessary height property + linting * fixed item-wrapper styling * linting fix
This commit is contained in:
parent
74d8b7fc50
commit
7bba8dafee
@ -1,11 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-row class="item-wrapper">
|
<el-row class="item-wrapper">
|
||||||
<el-col :span="3">
|
<el-col :span="3" :style="iconMargin">
|
||||||
<i v-if="icon.includes('el-icon')" class="icon sub-el-icon" />
|
<i v-if="icon.includes('el-icon')" class="icon sub-el-icon" />
|
||||||
<svg-icon v-else :icon-class="icon" />
|
<svg-icon v-else :icon-class="icon" />
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="21">
|
<el-col :span="21">
|
||||||
|
|
||||||
<p class="item-title">{{ title }}</p>
|
<p class="item-title">{{ title }}</p>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -22,6 +21,17 @@ export default {
|
|||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
},
|
||||||
|
addMargin: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
iconMargin() {
|
||||||
|
if (this.addMargin) {
|
||||||
|
return 'margin-left: -20px;'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -37,10 +47,22 @@ export default {
|
|||||||
white-space: break-spaces;
|
white-space: break-spaces;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
height: auto;
|
height: auto;
|
||||||
margin: 18px 23px 18px 0;
|
padding: 18px 23px 18px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-title {
|
.item-title {
|
||||||
margin: 0 0 0 7px;
|
margin: 0 0 0 7px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.el-row::before {
|
||||||
|
display: block;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-row::after {
|
||||||
|
display: block;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@ -11,12 +11,14 @@
|
|||||||
<el-tooltip v-if="!sidebar.opened && !isNest" effect="dark" :content="onlyOneChild.meta.title" placement="right">
|
<el-tooltip v-if="!sidebar.opened && !isNest" effect="dark" :content="onlyOneChild.meta.title" placement="right">
|
||||||
<item
|
<item
|
||||||
:icon="onlyOneChild.meta.icon || (item.meta && item.meta.icon)"
|
:icon="onlyOneChild.meta.icon || (item.meta && item.meta.icon)"
|
||||||
|
:add-margin="true"
|
||||||
/>
|
/>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<item
|
<item
|
||||||
v-else
|
v-else
|
||||||
:icon="onlyOneChild.meta.icon || (item.meta && item.meta.icon)"
|
:icon="onlyOneChild.meta.icon || (item.meta && item.meta.icon)"
|
||||||
:title="generateTitle(onlyOneChild.meta.title)"
|
:title="generateTitle(onlyOneChild.meta.title)"
|
||||||
|
:is-collapsed="isCollapsed"
|
||||||
/>
|
/>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</app-link>
|
</app-link>
|
||||||
@ -24,7 +26,13 @@
|
|||||||
|
|
||||||
<el-submenu v-else ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body>
|
<el-submenu v-else ref="subMenu" :index="resolvePath(item.path)" popper-append-to-body>
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
<item v-if="sidebar.opened" :icon="item.meta && item.meta.icon" :title="generateTitle(item.meta.title)" />
|
<item
|
||||||
|
v-if="sidebar.opened"
|
||||||
|
:icon="item.meta && item.meta.icon"
|
||||||
|
:title="generateTitle(item.meta.title)"
|
||||||
|
:is-collapsed="isCollapsed"
|
||||||
|
:has-child-items="true"
|
||||||
|
/>
|
||||||
<el-tooltip v-else effect="dark" :content="item.meta.title" placement="top-start">
|
<el-tooltip v-else effect="dark" :content="item.meta.title" placement="top-start">
|
||||||
<item v-if="item.meta && !isNest" :icon="item.meta && item.meta.icon" />
|
<item v-if="item.meta && !isNest" :icon="item.meta && item.meta.icon" />
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
@ -67,6 +75,10 @@ export default {
|
|||||||
basePath: {
|
basePath: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
|
},
|
||||||
|
isCollapsed: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -78,13 +90,7 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapGetters([
|
...mapGetters([
|
||||||
'sidebar'
|
'sidebar'
|
||||||
]),
|
])
|
||||||
isCollapse() {
|
|
||||||
if (this.sidebar.opened) {
|
|
||||||
return 'right'
|
|
||||||
}
|
|
||||||
return 'top'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
hasOneShowingChild(children = [], parent) {
|
hasOneShowingChild(children = [], parent) {
|
||||||
|
@ -12,7 +12,13 @@
|
|||||||
:collapse-transition="false"
|
:collapse-transition="false"
|
||||||
mode="vertical"
|
mode="vertical"
|
||||||
>
|
>
|
||||||
<sidebar-item v-for="route in menu" :key="route.path" :item="route" :base-path="route.path" />
|
<sidebar-item
|
||||||
|
v-for="route in menu"
|
||||||
|
:key="route.path"
|
||||||
|
:item="route"
|
||||||
|
:base-path="route.path"
|
||||||
|
:is-collapsed="!sidebar.opened"
|
||||||
|
/>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</el-scrollbar>
|
</el-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
|
@ -114,11 +114,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.submenu-title-noDropdown {
|
.submenu-title-noDropdown {
|
||||||
padding: 0 !important;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.el-tooltip {
|
.el-tooltip {
|
||||||
padding: 0 !important;
|
|
||||||
|
|
||||||
.svg-icon {
|
.svg-icon {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user