Parcourir la source

update element-ui

Pan il y a 7 ans
Parent
commit
74bb623d68

+ 1 - 1
package.json

@@ -14,7 +14,7 @@
   },
   "dependencies": {
     "axios": "0.17.1",
-    "element-ui": "2.0.8",
+    "element-ui": "2.3.4",
     "js-cookie": "2.2.0",
     "normalize.css": "7.0.0",
     "nprogress": "0.2.0",

+ 24 - 51
src/styles/sidebar.scss

@@ -2,18 +2,21 @@
   // 主体区域
   .main-container {
     min-height: 100%;
-    transition: margin-left 0.28s;
+    transition: margin-left .28s;
     margin-left: 180px;
-  } // 侧边栏
+  }
+  // 侧边栏
   .sidebar-container {
-    transition: width 0.28s;
-    width: 180px!important;
+    transition: width .28s;
+    width: 180px !important;
     height: 100%;
     position: fixed;
+    font-size: 0px;
     top: 0;
     bottom: 0;
     left: 0;
     z-index: 1001;
+    overflow: hidden;
     a {
       display: inline-block;
       width: 100%;
@@ -23,78 +26,48 @@
     }
     .el-menu {
       border: none;
-      width: 100%;
+      width: 100% !important;
     }
   }
   .hideSidebar {
-    .sidebar-container,.sidebar-container .el-menu {
-      width: 36px!important;
-      // overflow: inherit;
+    .sidebar-container {
+      width: 36px !important;
     }
     .main-container {
       margin-left: 36px;
     }
-  }
-  .hideSidebar {
     .submenu-title-noDropdown {
-      padding-left: 10px!important;
+      padding-left: 10px !important;
       position: relative;
-      span {
-        height: 0;
-        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-tooltip {
+        padding: 0 10px !important;
       }
     }
     .el-submenu {
       &>.el-submenu__title {
-        padding-left: 10px!important;
+        padding-left: 10px !important;
         &>span {
-          display: none;
+          height: 0;
+          width: 0;
+          overflow: hidden;
+          visibility: hidden;
+          display: inline-block;
         }
         .el-submenu__icon-arrow {
           display: none;
         }
       }
-      .nest-menu {
-        .el-submenu__icon-arrow {
-          display: block!important;
-        }
-        span {
-          display: inline-block!important;
-        }
-      }
     }
   }
   .nest-menu .el-submenu>.el-submenu__title,
   .el-submenu .el-menu-item {
-    min-width: 180px!important;
-    background-color: $subMenuBg!important;
+    min-width: 180px !important;
+    background-color: $subMenuBg !important;
     &:hover {
-      background-color: $menuHover!important;
+      background-color: $menuHover !important;
     }
   }
-  .el-menu--collapse .el-menu .el-submenu{
-    min-width: 180px!important;
+  .el-menu--collapse .el-menu .el-submenu {
+    min-width: 180px !important;
   }
 }

+ 5 - 4
src/views/layout/components/Sidebar/SidebarItem.vue

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

+ 10 - 1
src/views/layout/components/Sidebar/index.vue

@@ -1,6 +1,15 @@
 <template>
   <scroll-bar>
-    <el-menu mode="vertical" unique-opened :default-active="$route.path" :collapse="isCollapse" background-color="#304156" text-color="#fff" 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="routes"></sidebar-item>
     </el-menu>
   </scroll-bar>