index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <script setup>
  2. import { Setting } from "@element-plus/icons-vue";
  3. const handleOpen = (key, keyPath) => {
  4. console.log(key, keyPath);
  5. };
  6. const handleClose = (key, keyPath) => {
  7. console.log(key, keyPath);
  8. };
  9. </script>
  10. <template>
  11. <el-container class="app-layout">
  12. <el-aside width="200px" class="app-side">
  13. <div class="logo">
  14. <span>ADMIN UI</span>
  15. </div>
  16. <el-menu default-active="/home" class="side-menu" @open="handleOpen" @close="handleClose" router>
  17. <el-menu-item index="/home">
  18. <el-icon>
  19. <HomeFilled />
  20. </el-icon>
  21. <span>⾸⻚</span>
  22. </el-menu-item>
  23. <el-sub-menu index="/system">
  24. <template #title>
  25. <el-icon>
  26. <setting />
  27. </el-icon>
  28. <span>系统管理</span>
  29. </template>
  30. <el-menu-item index="/system/user">
  31. <el-icon>
  32. <Menu />
  33. </el-icon>
  34. <span>⽤户管理</span>
  35. </el-menu-item>
  36. <el-menu-item index="/system/role">
  37. <el-icon>
  38. <Menu />
  39. </el-icon>
  40. <span>⻆⾊管理</span>
  41. </el-menu-item>
  42. <el-menu-item index="/system/permission">
  43. <el-icon>
  44. <Menu />
  45. </el-icon>
  46. <span>权限管理</span>
  47. </el-menu-item>
  48. </el-sub-menu>
  49. </el-menu>
  50. </el-aside>
  51. <el-container class="app-cent-container">
  52. <el-header class="app-header">Header</el-header>
  53. <el-main class="app-content">
  54. <div class="content-wrapper">
  55. <router-view></router-view>
  56. </div>
  57. </el-main>
  58. </el-container>
  59. </el-container>
  60. </template>
  61. <style lang="less" scoped>
  62. .app-layout {
  63. height: 100vh;
  64. background-color: #f0f2f5;
  65. .app-side {
  66. background-color: #fff;
  67. box-shadow: 2px 0 8px 0 rgba(29, 35, 41, 0.05);
  68. position: relative;
  69. z-index: 10;
  70. .logo {
  71. height: 64px;
  72. display: flex;
  73. align-items: center;
  74. justify-content: center;
  75. padding: 0 24px;
  76. overflow: hidden;
  77. span {
  78. color: #0c0c0c;
  79. font-size: 18px;
  80. font-weight: 600;
  81. white-space: nowrap;
  82. }
  83. }
  84. .side-menu {
  85. border-right: none;
  86. }
  87. }
  88. .app-cent-container {
  89. position: fixed;
  90. top: 0;
  91. left: 200px;
  92. right: 0;
  93. bottom: 0;
  94. background-color: #f9f9f9;
  95. .app-header {
  96. display: flex;
  97. flex-direction: row;
  98. justify-content: space-between;
  99. height: 64px;
  100. background: #fff;
  101. padding-left: 16px;
  102. padding-right: 16px;
  103. line-height: 64px;
  104. align-items: center;
  105. border-bottom: 1px solid #d8dce5;
  106. }
  107. .app-content {
  108. display: flex;
  109. flex-direction: column;
  110. position: absolute;
  111. top: 104px;
  112. right: 20px;
  113. bottom: 20px;
  114. left: 20px;
  115. background-color: #fff;
  116. }
  117. }
  118. .app-footer {
  119. text-align: center;
  120. padding: 16px 24px;
  121. color: rgba(0, 0, 0, 0.45);
  122. font-size: 14px;
  123. background: #fff;
  124. .footer-links {
  125. margin-bottom: 8px;
  126. a {
  127. color: rgba(0, 0, 0, 0.45);
  128. margin: 0 8px;
  129. &:hover {
  130. color: rgba(0, 0, 0, 0.65);
  131. }
  132. }
  133. }
  134. }
  135. }
  136. </style>