CommonAside.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <el-menu default-active="1-4-1" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose"
  3. :collapse="isCollapse" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b" :router="true">
  4. <!-- 要放到导航栏里面 -->
  5. <h3>{{isCollapse?"菜单":"智能AI数据分析系统"}}</h3>
  6. <!-- 观察数据,我们发现name是唯一标识 -->
  7. <!-- 查看文档,index是唯一标识 -->
  8. <el-menu-item :key="'/index'" :index="'/index'">
  9. <el-icon><location /></el-icon>
  10. <template #title>
  11. <span>图表生成</span>
  12. </template>
  13. </el-menu-item>
  14. <el-menu-item :key="'/index/chart'" :index="'/index/chart'">
  15. <el-icon><CirclePlus /></el-icon>
  16. <template #title>
  17. <span>我的图表</span>
  18. </template>
  19. </el-menu-item>
  20. <el-sub-menu :key="1" :index="1" v-if="isAdmin">
  21. <template #title>
  22. <el-icon><location /></el-icon>
  23. <span>后台管理</span>
  24. </template>
  25. <el-menu-item-group :key="1" :index="1">
  26. <el-menu-item :index="'/index/userManage'" :key="'/index/userManage'">
  27. <el-icon><CirclePlus /></el-icon>
  28. <template #title>
  29. <span>用户管理</span>
  30. </template>
  31. </el-menu-item>
  32. <el-menu-item :index="'/index/chartManage'" :key="'/index/chartManage'">
  33. <el-icon><CirclePlus /></el-icon>
  34. <template #title>
  35. <span>图表管理</span>
  36. </template>
  37. </el-menu-item>
  38. </el-menu-item-group>
  39. </el-sub-menu>
  40. </el-menu>
  41. </template>
  42. <style lang="less" scoped>
  43. .el-menu-vertical-demo:not(.el-menu--collapse) {
  44. width: 200px;
  45. min-height: 400px;
  46. }
  47. .el-menu{
  48. height:100vh;
  49. h3{
  50. text-align: center;
  51. line-height: 48px;
  52. color: #fff;
  53. font-size: 16px;
  54. font-weight: 400;
  55. }
  56. }
  57. </style>
  58. <script>
  59. import {useTabStore} from '@/stores/index'
  60. import {isAdmin} from "../common/utils/auth.js";
  61. const tabStore = useTabStore();
  62. export default {
  63. data() {
  64. return {
  65. isCollapse: false,
  66. };
  67. },
  68. methods: {
  69. handleOpen(key, keyPath) {
  70. // console.log(key, keyPath);
  71. },
  72. handleClose(key, keyPath) {
  73. // console.log(key, keyPath);
  74. },
  75. },
  76. computed: {
  77. isCollapse() {
  78. return tabStore.isCollapse;
  79. },
  80. isAdmin(){
  81. return isAdmin();
  82. }
  83. }
  84. }
  85. </script>