<template>
  <!-- ICO-首页 -->
  <HeaderNav headerText="ICO"></HeaderNav>
  <div class="ico-index">
    <div class="index-classifi">
      <div class="pf600 fs18 fc121212" @click="messageChange('subscription')">认购</div>
      <div class="sys-notifi pf600 fs14 fcA8A8A8" @click="messageChange('placement')">
        配售
      </div>
      <div class="sys-notifi pf600 fs14 fcA8A8A8" @click="messageChange('lotteryResult')">
        中签结果
      </div>
      <div class="sys-notifi pf600 fs14 fcA8A8A8" @click="messageChange('coinPreview')">
        新币预览
      </div>
      <div class="sys-notifi pf600 fs14 fcA8A8A8" @click="messageChange('relus')">
        ICO规则
      </div>
    </div>
    <component :is="currentComponent" />
  </div>
</template>
<script setup>
  import HeaderNav from "../components/HeaderNav.vue";
  import CoinPreview from "./CoinPreview.vue";
  import LotteryResult from "./LotteryResult.vue";
  import Placement from "./Placement.vue";
  import Relus from "./Relus.vue";
  import Subscription from "./Subscription.vue";
  import { ref, computed } from "vue";

  const current = ref("subscription");
  const componentsMap = {
    coinPreview: CoinPreview,
    lotteryResult: LotteryResult,
    placement: Placement,
    relus: Relus,
    subscription: Subscription,
  };
  const currentComponent = computed(() => componentsMap[current.value]);

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

    .index-classifi {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      margin-top: 48px;
      width: 349px;
      height: 24px;
    }
  }
</style>
