main.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <div class="exposure">
  3. <div class="first-menu">
  4. <a-menu
  5. class="a-menu_container"
  6. theme="dark"
  7. v-model:selectedKeys="selectedKey"
  8. @click="selectMenu"
  9. mode="horizontal"
  10. >
  11. <a-menu-item :key="String(index)" v-for="(item, index) in list">{{ item.title}}</a-menu-item>
  12. </a-menu>
  13. <div class="menu_right">
  14. <!-- <slot></slot> -->
  15. </div>
  16. </div>
  17. <router-view />
  18. </div>
  19. </template>
  20. <script lang="ts">
  21. import { defineComponent, inject, Ref } from 'vue';
  22. import { useRouter } from 'vue-router';
  23. import { OperationTabMenu } from '@/services/go/commonService/interface';
  24. export default defineComponent({
  25. name: 'MAIN',
  26. components: {},
  27. setup() {
  28. const router = useRouter();
  29. const list = inject('thirdMenuList') as Ref<OperationTabMenu[]>;
  30. const selectedKey = inject('index');
  31. // 切换路由
  32. function selectMenu(value: any) {
  33. if (((selectedKey as unknown) as any).value[0] !== value.key) {
  34. const index = +value.key;
  35. router.push({ name: list.value[index].code });
  36. }
  37. }
  38. return { selectMenu, list, selectedKey };
  39. },
  40. });
  41. </script>
  42. <style lang="less">
  43. .exposure {
  44. height: 100%;
  45. position: relative;
  46. }
  47. .noBorderBottom {
  48. border-bottom: none;
  49. }
  50. .first-menu {
  51. width: 100%;
  52. height: 40px;
  53. border-bottom: 1px solid @m-blue0 !important;
  54. background-color: @m-black1;
  55. .flex;
  56. justify-content: space-between;
  57. .a-menu_container {
  58. padding-top: 5px;
  59. .flex();
  60. height: 34px;
  61. line-height: 34px;
  62. background: transparent;
  63. .ant-menu-item {
  64. min-width: 120px;
  65. height: 34px;
  66. line-height: 34px;
  67. background: linear-gradient(0deg, @m-grey35 0%, @m-grey36 100%);
  68. margin-left: 3px;
  69. font-size: 14px;
  70. color: @m-grey38;
  71. border-radius: 5px 5px 0px 0px;
  72. cursor: pointer;
  73. font-family: Adobe Heiti Std;
  74. border: 1px solid @m-grey37;
  75. &:hover {
  76. .noBorderBottom;
  77. }
  78. }
  79. .ant-menu-item-active {
  80. .noBorderBottom;
  81. }
  82. .ant-menu-item-selected {
  83. .noBorderBottom;
  84. color: @m-white0;
  85. background: linear-gradient(0deg, @m-blue31 0%, @m-blue32 100%);
  86. &:hover {
  87. color: @m-white0;
  88. }
  89. }
  90. }
  91. }
  92. </style>;