All files / components/organisms/SideBar SideBar.vue

100% Statements 49/49
100% Branches 20/20
100% Functions 2/2
100% Lines 49/49

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80  1x             1x 4x 4x 1x 1x 1x       1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 5x   1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 1x 1x 1x 3x 1x 1x 1x 3x 1x 1x 1x                                      
<script lang="ts" setup>
import {
  Document,
  Menu as IconMenu,
  Location,
  Setting,
} from "@element-plus/icons-vue";
 
const handleOpen = (key: string, keyPath: string[]) => {
  console.log(key, keyPath);
};
const handleClose = (key: string, keyPath: string[]) => {
  console.log(key, keyPath);
};
</script>
 
<template>
  <div class="sidebar">
    <div>
      <p class="menu_label">Menu</p>
    </div>
    <el-menu
      active-text-color="#ffd04b"
      background-color="#545c64"
      class="el-menu-vertical-demo"
      default-active="2"
      text-color="#fff"
      @open="handleOpen"
      @close="handleClose"
    >
      <el-sub-menu class="el_sub_menu" index="1">
        <template #title>
          <el-icon><location /></el-icon>
          <span>Navigator One</span>
        </template>
        <el-menu-item index="1-1" class="el-menu-item">
          <a href="/sample">sample</a>
        </el-menu-item>
        <el-menu-item index="1-2"> item two </el-menu-item>
        <el-menu-item-group title="Group Two">
          <el-menu-item index="1-3"> item three </el-menu-item>
        </el-menu-item-group>
        <el-sub-menu index="1-4">
          <template #title> item four </template>
          <el-menu-item index="1-4-1"> item one </el-menu-item>
        </el-sub-menu>
      </el-sub-menu>
      <el-menu-item class="el_sub_menu" index="2">
        <el-icon><icon-menu /></el-icon>
        <span>Navigator Two</span>
      </el-menu-item>
      <el-menu-item class="el_sub_menu" index="3" disabled>
        <el-icon><document /></el-icon>
        <span>Navigator Three</span>
      </el-menu-item>
      <el-menu-item class="el_sub_menu" index="4">
        <el-icon><setting /></el-icon>
        <span>Navigator Four</span>
      </el-menu-item>
    </el-menu>
  </div>
</template>
 
<style scoped>
.menu_label {
  color: #fff;
  font-size: 24px;
  padding-left: 12px;
}
 
.el_sub_menu {
  width: 200px;
}
 
.el-menu-item a {
  display: block;
  width: 100%;
}
</style>