<template>
  <div class="market">
    <div class="market-nav">
      <div class="nav-left">
        <div class="pf600 fs18 fc121212" @click="messageChange('selfSelected')">自选</div>
        <div class="sys-notifi pf600 fs14 fcA8A8A8" @click="messageChange('contract')">
          合约
        </div>
        <div
          class="sys-notifi pf600 fs14 fcA8A8A8"
          @click="messageChange('secondContract')">
          秒合约
        </div>
      </div>
      <div class="nav-right">
        <img src="../../assets/icon/market/search.svg" alt="" />
      </div>
    </div>
    <component :is="currentComponent" />
  </div>
</template>
<script setup>
  import Contract from "./Contract.vue";
  import SecondContract from "./SecondContract.vue";
  import SelfSelected from "./SelfSelected.vue";
  import { ref, computed } from "vue";

  const current = ref("selfSelected");
  const componentsMap = {
    contract: Contract,
    secondContract: SecondContract,
    selfSelected: SelfSelected,
  };
  const currentComponent = computed(() => componentsMap[current.value]);

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

    .market-nav {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      margin-top: 21px;
      width: 345px;
      height: 24px;

      .nav-left {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: flex-end;
        width: 345px;
        height: 24px;


        .sys-notifi {
          margin-left: 35px;
        }
      }

      .nav-right {
        width: 20px;
        height: 20px;
      }
    }
  }
</style>
