main.vue 2.5 KB

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