menu.vue 2.97 KB
<script setup lang="ts">
/**
 * 公共布局侧导航
 * @module Menu
 * @author Tengxi
 */
import { ref, computed } from "vue";
import * as store from "@/pinia/index";
import styles from "@/style/global.module.scss";
// TIP 使用element plus ICON
import {
  Location,
  Document,
  Menu as IconMenu,
  Setting,
} from "@element-plus/icons-vue";
// TIP 获取scss样式变量
let styleData = computed(() => {
  return styles;
});
let menuData = computed(() => {
  let res = store.family.menuStore().menuList;
  return res;
});
</script>

<template>
  <el-scrollbar wrap-class="scrollbar-wrapper">
    <!-- {{menuData}} -->
    <el-menu
      default-active="2"
      :background-color="styleData.menuBg"
      :text-color="styleData.menuText"
      :active-text-color="styleData.menuActiveText"
      class="el-menu-vertical-demo"
      :router="true"
      :collapse-transition="false"
      :collapse="store.family.appStore().isCollapse"
    >
      <el-sub-menu
        :index="index + ''"
        v-for="(item, index) in menuData"
        :key="index"
      >
        <template #title>
          <el-icon><location /></el-icon>
          <span>{{ item.name }}假菜单</span>
        </template>
        <el-menu-item-group v-for="(ele, i) in item.menuList" :key="i">
          <el-menu-item :index="ele.path ? ele.path : '/'">{{
            ele.name
          }}</el-menu-item>
        </el-menu-item-group>
      </el-sub-menu>

      <el-sub-menu index="11">
        <template #title>
          <el-icon><location /></el-icon>
          <span>物业管理真菜单可点</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/property">物业列表</el-menu-item>
        </el-menu-item-group>
      </el-sub-menu>
      <el-sub-menu index="12">
        <template #title>
          <el-icon><location /></el-icon>
          <span>小区管理真菜单可点</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/community">小区管理</el-menu-item>
          <el-menu-item index="/housekeeper">楼宇管理</el-menu-item>
          <el-menu-item index="/houses">房屋管理</el-menu-item>
        </el-menu-item-group>
      </el-sub-menu>
      <el-sub-menu index="13">
        <template #title>
          <el-icon><location /></el-icon>
          <span>用户管理真菜单可点</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/user">用户列表</el-menu-item>
        </el-menu-item-group>
      </el-sub-menu>
      <el-sub-menu index="14">
        <template #title>
          <el-icon><location /></el-icon>
          <span>角色管理真菜单可点</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/role">角色列表</el-menu-item>
        </el-menu-item-group>
      </el-sub-menu>
    </el-menu>
  </el-scrollbar>
</template>
<style lang="scss" scoped>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: $sideBarWidth;
  min-height: calc(100vh - 60px);
}
</style>