<!-- 无用组件，待废弃 -->
<template>
  <!-- 期货订单 -->
  <section class="futures_information">
    <component :is="componentId" v-if="componentId">
    </component>
    <thirdMenu :list="tabList" @selectMenu="changeTab" :value="'title'"></thirdMenu>
  </section>
</template>

<script lang="ts">
import { onBeforeUnmount } from 'vue'
import { defineAsyncComponent, defineComponent, nextTick } from 'vue';
import thirdMenu from '@/common/components/thirdMenu/index.vue';
import { handleOrderDetailList } from '@/common/setup/order/orderData';
import Bus from '@/utils/eventBus/index';

export default defineComponent({
  components: {
    thirdMenu,
    futures_information_position: defineAsyncComponent(() => import('./components/futures_information_position/index.vue')), // 持仓
    futures_information_entrust: defineAsyncComponent(() => import('./components/futures_information_entrust/index.vue')), // 委托
    futures_information_success: defineAsyncComponent(() => import('./components/futures_information_success/index.vue')), // 成交
  },
  setup() {
    const { componentId, tabList, changeTab } = handleOrderDetailList('futures_information');

    // 组件重新加载
    function componentReload() {
      const code = componentId.value;
      componentId.value = '';
      nextTick(() => {
        componentId.value = code;
      });
    }

    // 注册账户变化事件，待通知调用
    const stopNotify = Bus.$on('taAccountChangedNtf', () => {
      // 重新加载组件
      componentReload();
    });

    onBeforeUnmount(() => {
      stopNotify();
    })

    return {
      componentId,
      tabList,
      changeTab,
    };
  },
});
</script>