<template>
  <HeaderNav headerText="消息通知"></HeaderNav>
  <div class="notifi-index">
    <div class="notifi-classifi">
      <div class="pf600 fs18 fc121212" @click="messageChange('insite')">站内信</div>
      <div class="sys-notifi pf600 fs14 fcA8A8A8" @click="messageChange('sys')">
        系统通知
      </div>
    </div>
    <component :is="currentComponent" />
  </div>
</template>
<script setup>
  import HeaderNav from "../index/components/HeaderNav.vue";
  import InsiteMessage from "./InsiteMessage.vue";
  import SysMessage from "./SysMessage.vue";
  import { ref, computed } from "vue";

  const current = ref("insite");
  const componentsMap = {
    insite: InsiteMessage,
    sys: SysMessage,
  };
  const currentComponent = computed(() => componentsMap[current.value]);

  const messageChange = (key) => {
    current.value = key;
  };
</script>
<style lang="less" scoped>
  .notifi-index {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    width: 100%;

    .notifi-classifi {
      display: flex;
      flex-direction: row;
      justify-content: flex-start;
      align-items: flex-end;
      margin-top: 63px;
      width: 345px;
      height: 24px;

      .sys-notifi {
        margin-left: 43px;
      }
    }
  }
</style>
