<template>
    <view class="page-content h-screen">
        <mx-nav-bar title="资讯"/>
        <mx-tabs-swiper :tabs="types" template="news" border>
            <template #news="{value}">
                <news-paging-list :params="value"/>
            </template>
        </mx-tabs-swiper>
    </view>
</template>

<script setup>
import {ref, computed, onMounted} from 'vue'
import {getNewsTypes} from "@/api/webApi/career-news";
import NewsPagingList from "@/pages/news/index/components/news-paging-list.vue";

const current = ref(0)
const types = ref([])
const currentType = computed(() => types.value[current.value])

onMounted(async () => {
    const {rows} = await getNewsTypes()
    const tabs = rows.map(tab => ({
        name: tab.label,
        value: {type: tab.value}
    }))
    tabs.unshift({
        name: '热门资讯',
        value: {tag: 'hot'}
    })
    types.value = tabs
})
</script>

<style lang="scss">

</style>
