qNav.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <div id="box-main">
  3. <div class="main-container">
  4. <aside class="sidebar">
  5. <nav class="menu">
  6. <router-link
  7. v-for="item in menuItems"
  8. :key="item.path"
  9. :to="item.path"
  10. @click.native="setActiveMenu(item.title)"
  11. class="menu-item"
  12. >
  13. <i :class="`${item.icon}`"></i>
  14. <span>{{ item.title }}</span>
  15. <img
  16. style="margin-left: 68px"
  17. src="../assets/img/gogogo.png"
  18. alt=""
  19. />
  20. </router-link>
  21. </nav>
  22. </aside>
  23. <main class="content-area">
  24. <router-view />
  25. </main>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. str: false,
  34. menuItems: [
  35. {
  36. path: "/index/homepage",
  37. icon: "el-icon-s-unfold",
  38. title: "设备管理",
  39. name: "Device",
  40. }, // 新增唯一name
  41. {
  42. path: "/index/userManagement",
  43. icon: "el-icon-s-custom",
  44. title: "用户管理",
  45. name: "User",
  46. },
  47. {
  48. path: "/index/roleManagement",
  49. icon: "el-icon-user",
  50. title: "角色管理",
  51. name: "Role",
  52. }, // 修改icon
  53. {
  54. path: "/index/powerManagement",
  55. icon: "el-icon-s-check",
  56. title: "权限管理",
  57. name: "Power",
  58. }, // 修改icon
  59. {
  60. path: "/index/tenantManagement",
  61. icon: "el-icon-menu",
  62. title: "租户管理",
  63. name: "zuhu",
  64. },
  65. {
  66. path: "/index/ContactUs",
  67. icon: "el-icon-phone",
  68. title: "联系我们",
  69. name: "ContactUs",
  70. },
  71. {
  72. path: "/index/RepairRecord",
  73. icon: "el-icon-s-tools",
  74. title: "报修记录",
  75. name: "RepairRecord",
  76. },
  77. {
  78. path: "/index/FeedbackInformation",
  79. icon: "el-icon-chat-dot-square",
  80. title: "反馈信息",
  81. name: "FeedbackInformation",
  82. },
  83. ],
  84. };
  85. },
  86. methods: {
  87. setActiveMenu(menuItemTitle) {
  88. this.$store.dispatch("updateActiveMenuItem", menuItemTitle);
  89. },
  90. },
  91. mounted() {},
  92. };
  93. </script>
  94. <style lang="scss" scoped>
  95. #box-main::v-deep {
  96. .main-container {
  97. position: absolute;
  98. left: 0;
  99. top: calc(100vh * 198 / 1080);
  100. bottom: 0;
  101. width: 100%;
  102. background: #dee6ef;
  103. display: flex;
  104. flex-direction: row;
  105. flex: 1;
  106. .sidebar {
  107. width: 268px;
  108. height: calc(100vh * 970 / 1080);
  109. background: #021327;
  110. box-shadow: 6px 0px 9px 0px rgba(27, 30, 46, 0.26);
  111. border-radius: 0px 12px 0px 0px;
  112. position: absolute;
  113. top: calc(100vh * -88 / 1080);
  114. z-index: 111;
  115. }
  116. .content-area {
  117. display: block;
  118. flex: 1;
  119. flex-basis: auto;
  120. overflow: auto;
  121. box-sizing: border-box;
  122. position: absolute;
  123. left: 268px;
  124. top: -50px;
  125. bottom: 0;
  126. right: 0;
  127. margin: 20px;
  128. width: 1594px;
  129. height: 83.7962962963vh;
  130. background: #f1f5fa;
  131. border-radius: 12px;
  132. }
  133. .menu {
  134. .menu-item {
  135. display: flex;
  136. align-items: center;
  137. padding: 15px;
  138. font-family: "Microsoft YaHei";
  139. font-weight: bold;
  140. font-size: 16px;
  141. color: #d2e0f1;
  142. text-decoration: none;
  143. background: transparent; // 默认背景
  144. border-radius: 0; // 默认圆角
  145. &.router-link-exact-active {
  146. color: #ffffff;
  147. background: #1c6fec;
  148. border-radius: 10px;
  149. }
  150. span {
  151. padding-left: 15px;
  152. }
  153. }
  154. }
  155. }
  156. }
  157. </style>