<template>
    <index-title-wrap title="最新动态">
        <template v-if="false" #more>
            <view>
                <uv-text type="tips" size="13" text="更多" suffix-icon="arrow-right" @click="handleMore"/>
            </view>
        </template>
        <news-list>
            <news-list-item v-for="n in list" :key="n.id" :item="n"/>
        </news-list>
    </index-title-wrap>
</template>

<script setup>
import {ref, onMounted} from 'vue'
import {getNewsList} from "@/api/webApi/career-news";
import {useTransfer} from "@/hooks/useTransfer";
import IndexTitleWrap from "@/pagesOther/pages/index/components/index-title-wrap.vue";
import NewsList from "@/pagesOther/pages/index/components/news-list.vue";
import NewsListItem from "@/pagesOther/pages/index/components/news-list-item.vue";
import mxConst from "@/common/mxConst";

const list = ref([])
const {transferTo} = useTransfer()

onMounted(() => getList())

async function getList() {
    const {rows} = await getNewsList({pageNum: 1, pageSize: 5, tag: '', top: true})
    list.value = rows
}

function handleMore() {
    transferTo(mxConst.routes.newsIndex)
}
</script>
<script>
export default {
    name: "news-top"
}
</script>

<style scoped>
</style>
