You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.2 KiB
50 lines
1.2 KiB
<script setup>
|
|
|
|
const newsData = computed(() => newsRes.value.data);
|
|
|
|
const page = ref(1)
|
|
const pageSize = ref(10)
|
|
|
|
// 取得新聞資料
|
|
const { data: newsRes } = await useMyFetch('/social/getNewsList', "POST", {
|
|
page: page.value,
|
|
pageSize: pageSize.value,
|
|
})
|
|
|
|
const handlePageChange = async (npage,npageSize) => {
|
|
page.value = npage
|
|
pageSize.value = npageSize
|
|
|
|
newsRes.value = await useRequest('/social/getNewsList', "POST", {
|
|
page: page.value,
|
|
pageSize: pageSize.value,
|
|
})
|
|
}
|
|
|
|
</script>
|
|
|
|
<template>
|
|
<div class="toolbar">
|
|
<div class="tTitle">{{ $t('Social.news') }}</div>
|
|
</div>
|
|
<div class="content">
|
|
<div>
|
|
<NuxtLinkLocale :to="'/social/news/detail/' + item.id" class="item" v-for="(item, index) in newsData.list" :key="index">
|
|
<div class="title ellipsis">{{ item.title }}</div>
|
|
<div class="date">{{ item.create_time }}</div>
|
|
</NuxtLinkLocale>
|
|
</div>
|
|
<div class="pagination-block">
|
|
<el-pagination layout="->, prev, pager, next" :total="newsData.total"
|
|
@change="handlePageChange"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style lang="less">
|
|
.pagination-block {
|
|
margin-bottom: 16px;
|
|
}
|
|
</style>
|