Update to Element ui@2.3.0 (#596)

* update element-ui && refactor sidebar.css

* format
This commit is contained in:
花裤衩 2018-04-13 10:23:05 +08:00 committed by GitHub
parent d29a9486a2
commit c5faa63ee5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 57 deletions

View file

@ -18,7 +18,7 @@
"codemirror": "5.32.0", "codemirror": "5.32.0",
"dropzone": "5.2.0", "dropzone": "5.2.0",
"echarts": "3.8.5", "echarts": "3.8.5",
"element-ui": "2.0.8", "element-ui": "2.3.2",
"file-saver": "1.3.3", "file-saver": "1.3.3",
"font-awesome": "4.7.0", "font-awesome": "4.7.0",
"js-cookie": "2.2.0", "js-cookie": "2.2.0",

View file

@ -2,18 +2,21 @@
// 主体区域 // 主体区域
.main-container { .main-container {
min-height: 100%; min-height: 100%;
transition: margin-left 0.28s; transition: margin-left .28s;
margin-left: 180px; margin-left: 180px;
} // 侧边栏 }
// 侧边栏
.sidebar-container { .sidebar-container {
transition: width 0.28s; transition: width .28s;
width: 180px!important; width: 180px !important;
height: 100%; height: 100%;
position: fixed; position: fixed;
font-size: 0px;
top: 0; top: 0;
bottom: 0; bottom: 0;
left: 0; left: 0;
z-index: 1001; z-index: 1001;
overflow: hidden;
a { a {
display: inline-block; display: inline-block;
width: 100%; width: 100%;
@ -23,78 +26,48 @@
} }
.el-menu { .el-menu {
border: none; border: none;
width: 100%; width: 100% !important;
} }
} }
.hideSidebar { .hideSidebar {
.sidebar-container,.sidebar-container .el-menu { .sidebar-container {
width: 36px!important; width: 36px !important;
// overflow: inherit;
} }
.main-container { .main-container {
margin-left: 36px; margin-left: 36px;
} }
}
.hideSidebar {
.submenu-title-noDropdown { .submenu-title-noDropdown {
padding-left: 10px!important; padding-left: 10px !important;
position: relative; position: relative;
span { .el-tooltip {
height: 0; padding: 0 10px !important;
width: 0;
overflow: hidden;
visibility: hidden;
transition: opacity .3s cubic-bezier(.55, 0, .1, 1);
opacity: 0;
display: inline-block;
}
&:hover {
span {
display: block;
border-radius: 3px;
z-index: 1002;
width: 140px;
height: 56px;
visibility: visible;
position: absolute;
right: -145px;
text-align: left;
text-indent: 20px;
top: 0px;
background-color: $subMenuBg!important;
opacity: 1;
}
} }
} }
.el-submenu { .el-submenu {
&>.el-submenu__title { &>.el-submenu__title {
padding-left: 10px!important; padding-left: 10px !important;
&>span { &>span {
display: none; height: 0;
width: 0;
overflow: hidden;
visibility: hidden;
display: inline-block;
} }
.el-submenu__icon-arrow { .el-submenu__icon-arrow {
display: none; display: none;
} }
} }
.nest-menu {
.el-submenu__icon-arrow {
display: block!important;
}
span {
display: inline-block!important;
}
}
} }
} }
.nest-menu .el-submenu>.el-submenu__title, .nest-menu .el-submenu>.el-submenu__title,
.el-submenu .el-menu-item { .el-submenu .el-menu-item {
min-width: 180px!important; min-width: 180px !important;
background-color: $subMenuBg!important; background-color: $subMenuBg !important;
&:hover { &:hover {
background-color: $menuHover!important; background-color: $menuHover !important;
} }
} }
.el-menu--collapse .el-menu .el-submenu{ .el-menu--collapse .el-menu .el-submenu {
min-width: 180px!important; min-width: 180px !important;
} }
} }

View file

@ -2,17 +2,18 @@
<div class="menu-wrapper"> <div class="menu-wrapper">
<template v-for="item in routes" v-if="!item.hidden&&item.children"> <template v-for="item in routes" v-if="!item.hidden&&item.children">
<router-link v-if="hasOneShowingChildren(item.children) && !item.children[0].children&&!item.alwaysShow" :to="item.path+'/'+item.children[0].path" :key="item.children[0].name"> <router-link v-if="hasOneShowingChildren(item.children) && !item.children[0].children&&!item.alwaysShow" :to="item.path+'/'+item.children[0].path"
:key="item.children[0].name">
<el-menu-item :index="item.path+'/'+item.children[0].path" :class="{'submenu-title-noDropdown':!isNest}"> <el-menu-item :index="item.path+'/'+item.children[0].path" :class="{'submenu-title-noDropdown':!isNest}">
<svg-icon v-if="item.children[0].meta&&item.children[0].meta.icon" :icon-class="item.children[0].meta.icon"></svg-icon> <svg-icon v-if="item.children[0].meta&&item.children[0].meta.icon" :icon-class="item.children[0].meta.icon"></svg-icon>
<span v-if="item.children[0].meta&&item.children[0].meta.title">{{generateTitle(item.children[0].meta.title)}}</span> <span v-if="item.children[0].meta&&item.children[0].meta.title" slot="title">{{generateTitle(item.children[0].meta.title)}}</span>
</el-menu-item> </el-menu-item>
</router-link> </router-link>
<el-submenu v-else :index="item.name||item.path" :key="item.name"> <el-submenu v-else :index="item.name||item.path" :key="item.name">
<template slot="title"> <template slot="title">
<svg-icon v-if="item.meta&&item.meta.icon" :icon-class="item.meta.icon"></svg-icon> <svg-icon v-if="item.meta&&item.meta.icon" :icon-class="item.meta.icon"></svg-icon>
<span v-if="item.meta&&item.meta.title">{{generateTitle(item.meta.title)}}</span> <span v-if="item.meta&&item.meta.title" slot="title">{{generateTitle(item.meta.title)}}</span>
</template> </template>
<template v-for="child in item.children" v-if="!child.hidden"> <template v-for="child in item.children" v-if="!child.hidden">
@ -21,7 +22,7 @@
<router-link v-else :to="item.path+'/'+child.path" :key="child.name"> <router-link v-else :to="item.path+'/'+child.path" :key="child.name">
<el-menu-item :index="item.path+'/'+child.path"> <el-menu-item :index="item.path+'/'+child.path">
<svg-icon v-if="child.meta&&child.meta.icon" :icon-class="child.meta.icon"></svg-icon> <svg-icon v-if="child.meta&&child.meta.icon" :icon-class="child.meta.icon"></svg-icon>
<span v-if="child.meta&&child.meta.title">{{generateTitle(child.meta.title)}}</span> <span v-if="child.meta&&child.meta.title" slot="title">{{generateTitle(child.meta.title)}}</span>
</el-menu-item> </el-menu-item>
</router-link> </router-link>
</template> </template>

View file

@ -1,6 +1,15 @@
<template> <template>
<scroll-bar> <scroll-bar>
<el-menu mode="vertical" :default-active="$route.path" :collapse="isCollapse" background-color="#304156" text-color="#bfcbd9" active-text-color="#409EFF"> <el-menu
mode="vertical"
:collapse-transition="false"
:show-timeout="200"
:default-active="$route.path"
:collapse="isCollapse"
background-color="#304156"
text-color="#bfcbd9"
active-text-color="#409EFF"
>
<sidebar-item :routes="permission_routers"></sidebar-item> <sidebar-item :routes="permission_routers"></sidebar-item>
</el-menu> </el-menu>
</scroll-bar> </scroll-bar>