<script setup>
import {ref} from 'vue'
import IndexContent from './components/IndexContent.vue'
import {apiPositionAnalysisList} from '@/api/positionAnalysis'

let activeType=ref('')
let list=ref([])
let loading=ref(false)
function getList(){
    loading.value=true
    apiPositionAnalysisList().then(res=>{
        loading.value=false
        if(res.code===200){
            list.value=res.data||[]
            activeType.value=res.data[0]&&res.data[0].exchange
        }
        const postData={
            path:'/pages/positionAnalysis/index',
            params:{},
            title:'持仓分析',
            shareImg:''
        }
        wx.miniProgram.postMessage({ data: postData })
    })
}
getList()



</script>

<template>
    <div class="position-analysis-index-page" v-loading="loading" element-loading-text="Loading...">
        <el-tabs 
            class="tabs-wrap"
            v-model="activeType"
        >
            <el-tab-pane 
                v-for="item in list"
                :key="item.exchange"
                :label="item.exchange" 
                :name="item.exchange"
            >
                <indexContent :list="item.items" :num="item.num" :time="item.data_time" :exchange="item.exchange"/>
            </el-tab-pane>
            
        </el-tabs>
    </div>
</template>

<style lang="scss">
.position-analysis-index-page{
    min-height: 60vh;
    .tabs-wrap{
        .el-tabs__nav-wrap::after{
            display: none;
        }
        .el-tabs__item{
            font-size: 16px;
        }
    }
}
</style>