<template>
  <div class="siderbar-contaiter">
    <div
      v-for="(item, index) in this.permission_routes[5].children"
      :key="index"
    >
      <router-link
        :to="item.path"
        class="routerlink"
        :class="[$route.name === item.name ? 'isactive' : '']"
      >
        <img
          :src="
            $route.name === item.name
              ? require(`./assets/i${index + 1}-active.png`)
              : require(`./assets/i${index + 1}.png`)
          "
        />
        <span>{{ item.meta.title }}</span>
      </router-link>
    </div>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
export default {
  name: "Sidebar",
  computed: {
    ...mapGetters(["permission_routes"]),
  },
  mounted() {},
};
</script>

<style lang="scss" scoped>
.siderbar-contaiter {
  width: 90px !important;
  height: 100%;
  padding: 0 5px;
  box-sizing: border-box;
  overflow: hidden;
  .routerlink {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
    width: 80px;
    height: 80px;
    align-items: center;
    justify-content: space-evenly;
    img {
      width: 24px;
      height: 24px;
    }
    span {
      width: 100%;
      text-align: center;
      font-size: 14px;
      font-weight: 500;
      color: #9aa6bb;
    }
  }
  .isactive {
    background-color: #636c97;
    border-radius: 8px;
    span {
      font-weight: 500;
      color: #ffffff;
    }
  }
  .routerlink:hover {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    margin-bottom: 16px;
    background-color: #1c263a;
    box-sizing: border-box;
  }
  .isactive:hover {
    background-color: #636c97;
  }
}
@media screen and (max-width: 1400px) {
  .siderbar-contaiter {
    .routerlink {
      span {
        transform: scale(0.8);
        width: calc(100% + 60px);
      }
    }
  }
}
@media screen and(max-width:1279px) {
  .siderbar-contaiter {
    .routerlink {
      span {
        transform: scale(0.7);
        width: calc(100% + 60px);
      }
    }
  }
}
</style>
