<template>
  <!-- 我的资产 -->
  <HeaderNav headerText="资产"></HeaderNav>
  <div class="user-asset">
    <div class="notifi-classifi pf600 fs14">
      <div class="fc121212" @click="messageChange('overview')">总览</div>
      <div class="fcA8A8A8" @click="messageChange('balance')">余额</div>
      <div class="fcA8A8A8" @click="messageChange('contract')">合约</div>
      <div class="fcA8A8A8" @click="messageChange('financialManagement')">理财</div>
      <div class="fcA8A8A8" @click="messageChange('option')">期权</div>
      <div class="fcA8A8A8" @click="messageChange('miaoContract')">秒合约</div>
      <div class="fcA8A8A8" @click="messageChange('lever')">币币</div>
    </div>
    <component :is="currentComponent" />
  </div>
</template>
<script setup>
  import HeaderNav from "../index/components/HeaderNav.vue";
  import Balance from "./myAsset/Balance.vue";
  import Contract from "./myAsset/Contract.vue";
  import FinancialManagement from "./myAsset/FinancialManagement.vue";
  import Lever from "./myAsset/Lever.vue";
  import MiaoContract from "./myAsset/MiaoContract.vue";
  import Option from "./myAsset/Option.vue";
  import Overview from "./myAsset/Overview.vue";
  import { ref, computed } from "vue";

  const current = ref("overview");
  const componentsMap = {
    balance: Balance,
    contract: Contract,
    financialManagement: FinancialManagement,
    lever: Lever,
    miaoContract: MiaoContract,
    option: Option,
    overview: Overview,
  };
  const currentComponent = computed(() => componentsMap[current.value]);

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

    .notifi-classifi {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: flex-end;
      margin-top: calc(48px);
      width: 345px;
      height: 24px;
    }
  }
</style>
