diff --git a/src/views/board/BoardList.vue b/src/views/board/BoardList.vue
index f5428dc..28aacfc 100644
--- a/src/views/board/BoardList.vue
+++ b/src/views/board/BoardList.vue
@@ -51,7 +51,7 @@
-
+
{
return date.isToday() || date.isYesterday();
};
-// 검색 처리 (검색 시 첫 페이지부터 조회)
+// 검색 처리
const search = (e) => {
searchText.value = e.trim();
fetchGeneralPosts(1);
};
-// 정렬 변경 핸들러 (첫 페이지부터 정렬)
+// 정렬 변경 핸들러
const handleSortChange = () => {
fetchGeneralPosts(1);
};
@@ -186,8 +186,11 @@ const fetchGeneralPosts = async (page = 1) => {
});
if (data?.data) {
- generalList.value = data.data.list.map(post => ({
- id: post.id,
+ console.log(data)
+ const totalPosts = data.data.total; // 전체 게시물 개수 받아오기 (API가 제공해야 함)
+
+ generalList.value = data.data.list.map((post, index) => ({
+ id: totalPosts - ((page - 1) * selectedSize.value) - index,
title: post.title,
author: post.author || '익명',
date: formatDate(post.date), // 날짜 변환 적용
@@ -229,7 +232,7 @@ const fetchNoticePosts = async () => {
id: post.id,
title: post.title,
author: post.author || '관리자',
- date: formatDate(post.date), // 날짜 변환 적용
+ date: formatDate(post.date),
views: post.cnt || 0,
hasAttachment: post.hasAttachment || false,
img: post.firstImageUrl || null
@@ -259,7 +262,6 @@ onMounted(() => {
.notice-row {
background-color: #f8f9fa;
}
-
.notice-row td {
color: #DC3545 !important;
}