heyujie
2021-11-03 57094ef66e4afb413c39ecd181e65938315c195c
src/pages/shuohuangMonitorAnalyze/components/leftNav.vue
@@ -1,14 +1,15 @@
<template>
  <div class="left-nav">
  <div class="left-nav" :class="{ short: isCollapse }">
    <img class="icon" src="/images/shuohuang/railroad.png" />
    <h1>
      <img class="icon" :src="`${publicPath}images/shuohuang/railroad.png`" style="height: 40px;" />
      <span v-show="!isCollapse" style="padding-left: 6px;">朔黄铁路机辆分公司</span>
      <span v-show="!isCollapse" style="padding-left: 6px"
        >朔黄铁路机辆分公司</span
      >
    </h1>
    <el-menu
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      :collapse="isCollapse"
      :default-active="activeIndex"
      @select="handleSelect"
    >
@@ -55,17 +56,16 @@
</template>
<script>
//import railroadImg from '/images/shuohuang/railroad.png';
export default {
  props: {
    isCollapse: {
      type: Boolean,
      default: true
      default: true,
    },
    menuChange: {
      type: Function
    }
      type: Function,
    },
  },
  computed: {
    isAdmin() {
@@ -82,8 +82,8 @@
  data() {
    return {
      publicPath: process.env.BASE_URL,
      activeIndex: 'guideIndex'
    }
      activeIndex: "guideIndex",
    };
  },
  mounted() {
    // if (this.isAdmin) {
@@ -92,51 +92,91 @@
    //     this.activeIndex = sessionStorage.getItem('leftNavAct');
    //   }
    // }
    this.activeIndex = this.isAdmin ? 'guideIndex' : 'searchForVideoAnalyze';
    this.activeIndex = this.isAdmin ? "guideIndex" : "searchForVideoAnalyze";
    this.$emit('menuChange', this.activeIndex);
    this.$emit("menuChange", this.activeIndex);
  },
  methods: {
    handleSelect(index, indePath) {
      this.activeIndex = index;
      sessionStorage.setItem('leftNavAct', this.activeIndex);
      this.$emit('menuChange', index);
      sessionStorage.setItem("leftNavAct", this.activeIndex);
      this.$emit("menuChange", index);
    },
    handleOpen() {
    handleOpen() {},
    handleClose() {},
    },
    handleClose() {
    }
  }
}
};
</script>
<style lang="scss">
.left-nav {
  background: #fff;
  background-image: url(/images/shuohuang/背景.png);
  height: 100vh;
  width: 250px;
  img {
    margin-top: 80px;
    margin-bottom: 10px;
    height: 96px;
    width: 96px;
  }
  h1 {
    display: flex;
    align-items: center;
    height: 65px;
    padding: 0 20px;
    border-bottom: 1px solid #eee;
    color: rgb(0, 150, 250);
    border: none;
    span {
      color: #fff;
    }
  }
  .iconfont {
    padding-right: 10px;
  }
  .el-menu-vertical-demo:not(.el-menu--collapse) {
    border: none;
    padding-right: 0;
    padding-left: 50px;
    width: 250px;
    background: none;
  }
  .el-menu.el-menu--inline {
    background: none;
  }
  .el-menu-item,
  .el-submenu__title {
    text-align: left;
    font-weight: 700;
    color: #fff;
    span {
      color: #fff;
    }
    i {
      color: #fff;
    }
    &:hover {
      color: #0b41a7;
      span {
        color: #0b41a7;
      }
      i {
        color: #0b41a7;
      }
    }
    border-radius: 10px 0 0 10px;
  }
  .el-menu-item.is-active {
    color: #409eff;
    background-color: #ecf0fc;
    color: #0b41a7;
    span {
      color: #0b41a7;
  }
}
}
.short {
  width: 0;
  overflow: hidden;
}
</style>