Index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <HeaderNav headerText="消息通知"></HeaderNav>
  3. <div class="notifi-index">
  4. <div class="notifi-classifi pf600 fs18 fc121212">
  5. <div
  6. class="classifi-item"
  7. :class="current == 'insite' ? 'current-classifi' : 'pf600 fs14 fcA8A8A8'"
  8. @click="messageChange('insite')">
  9. 站内信
  10. <div class="active-line" v-if="current == 'insite'"></div>
  11. </div>
  12. <div
  13. class="classifi-item"
  14. :class="current == 'sys' ? 'current-classifi' : 'pf600 fs14 fcA8A8A8'"
  15. @click="messageChange('sys')">
  16. 系统通知
  17. <div class="active-line" v-if="current == 'sys'"></div>
  18. </div>
  19. </div>
  20. <component :is="currentComponent" />
  21. </div>
  22. </template>
  23. <script setup>
  24. import HeaderNav from "../index/components/HeaderNav.vue";
  25. import InsiteMessage from "./InsiteMessage.vue";
  26. import SysMessage from "./SysMessage.vue";
  27. import { ref, computed } from "vue";
  28. const current = ref("insite");
  29. const componentsMap = {
  30. insite: InsiteMessage,
  31. sys: SysMessage,
  32. };
  33. const currentComponent = computed(() => componentsMap[current.value]);
  34. const messageChange = (key) => {
  35. current.value = key;
  36. };
  37. </script>
  38. <style lang="less" scoped>
  39. .notifi-index {
  40. display: flex;
  41. flex-direction: column;
  42. justify-content: flex-start;
  43. align-items: center;
  44. width: 100%;
  45. .notifi-classifi {
  46. display: flex;
  47. flex-direction: row;
  48. justify-content: flex-start;
  49. align-items: flex-end;
  50. margin-top: 48px;
  51. width: 345px;
  52. height: 24px;
  53. .classifi-item {
  54. position: relative;
  55. margin-left: 43px;
  56. .active-line {
  57. position: absolute;
  58. bottom: -6px;
  59. left: 50%;
  60. transform: translateX(-50%);
  61. width: 20px;
  62. height: 3px;
  63. background-color: #323233;
  64. border-radius: 2px;
  65. }
  66. &:first-child {
  67. margin-left: 0;
  68. }
  69. }
  70. .current-classifi {
  71. font-family: "PingFang SC";
  72. font-style: normal;
  73. font-weight: 600;
  74. font-size: 18px;
  75. color: #121212;
  76. transition: color 0.3s, font-size 0.3s;
  77. }
  78. }
  79. }
  80. </style>