프로젝트 목록

This commit is contained in:
yoon 2025-02-10 16:07:24 +09:00
parent 608f7be852
commit 34acf8aedb
4 changed files with 22 additions and 63 deletions

View File

@ -2,7 +2,7 @@
<div class="card mb-3 shadow-sm border">
<div class="row g-0">
<!-- 게시물 내용 섹션 -->
<div :class="contentColClass">
<div>
<div class="card-body">
<!-- 제목 -->
<h5 class="card-title">
@ -16,18 +16,6 @@
<!-- 날짜 -->
<div class="d-flex flex-column flex-sm-row justify-content-between align-items-start">
<small class="text-muted">{{ formattedDate }}</small>
<!-- 조회수, 좋아요, 댓글 -->
<div class="d-flex mt-2 mt-sm-0">
<span class="text-muted me-3">
<i class="fa-regular fa-eye"></i> {{ views || 0 }}
</span>
<span class="text-muted me-3" v-if="likes != null">
<i class="bx bx-like"></i> {{ likes }}
</span>
<span class="text-muted" v-if="comments !== null">
<i class="bx bx-comment"></i> {{ comments }}
</span>
</div>
</div>
</div>
</div>
@ -57,29 +45,12 @@ const props = defineProps({
type: String,
required: true,
},
views: {
type: Number,
default: 0,
},
likes: {
type: Number,
default: null,
},
comments: {
type: Number,
default: null,
},
attachment: {
type: Boolean,
default: false,
}
});
// computed
const contentColClass = computed(() => {
return props.img ? 'col-sm-10 col-12' : 'col-sm-12';
});
// formattedDate computed
const formattedDate = computed(() => {
const date = new Date(props.date);

View File

@ -9,8 +9,6 @@
:title="post.title"
:content="post.content"
:date="post.date"
:views="post.views || 0"
v-bind="getProjectCardProps(post)"
:attachment="post.attachment || false"
/>
</div>
@ -28,8 +26,6 @@ const posts = ref([
title: 'Vue 3 Composition API 소개',
content: 'Composition API를 사용하여 Vue 3에서 효율적으로 개발하는 방법을 알아봅니다. Composition API를 사용하여 Vue 3에서 효율적으로 개발하는 방법을 알아봅니다. Composition API를 사용하여 Vue 3에서 효율적으로 개발하는 방법을 알아봅니다. Composition API를 사용하여 Vue 3에서 효율적으로 개발하는 방법을 알아봅니다. Composition API를 사용하여 Vue 3에서 효율적으로 개발하는 방법을 알아봅니다. Composition API를 사용하여 Vue 3에서 효율적으로 개발하는 방법을 알아봅니다.',
date: '2025-02-10',
views: 120,
likes: 15,
comments: 4,
attachment: true
},
@ -38,8 +34,6 @@ const posts = ref([
title: 'Spring Boot로 REST API 만들기',
content: 'Spring Boot를 사용하여 간단한 RESTful API를 구현하는 방법을 다룹니다.',
date: '2025-02-09',
views: 89,
likes: 8,
comments: 2,
attachment: false
}
@ -52,15 +46,4 @@ const goDetail = (id) => {
emit('click', id);
};
//
const getProjectCardProps = (post) => {
const projectCardProps = {};
if ('likes' in post) {
projectCardProps.likes = post.likes;
}
if ('comments' in post) {
projectCardProps.comments = post.comments;
}
return projectCardProps;
};
</script>

View File

@ -0,0 +1,19 @@
<template>
<SearchBar />
<CategoryBtn :lists="yearCategory" />
<ProjectCardList :category="selectedCategory" />
</template>
<script setup>
import SearchBar from '@c/search/SearchBar.vue';
import ProjectCardList from '@c/list/ProjectCardList.vue';
import CategoryBtn from '@c/category/CategoryBtn.vue';
import commonApi from '@/common/commonApi'
import { ref } from 'vue';
const selectedCategory = ref(null);
const { yearCategory } = commonApi();
</script>

View File

@ -1,24 +1,10 @@
<template>
<div class="container-xxl flex-grow-1 container-p-y">
<SearchBar />
<CategoryBtn :lists="testData" />
<ProjectCardList :category="selectedCategory" />
<ProjectList />
</div>
</template>
<script setup>
import SearchBar from '@c/search/SearchBar.vue';
import ProjectCardList from '@c/list/ProjectCardList.vue';
import CategoryBtn from '@c/category/CategoryBtn.vue';
import { ref } from 'vue';
const selectedCategory = ref(null);
//
const testData = [
{ CMNCODVAL: 'cat1', CMNCODNAM: 'All' },
{ CMNCODVAL: 'cat2', CMNCODNAM: '2024' },
{ CMNCODVAL: 'cat3', CMNCODNAM: '2025' },
];
import ProjectList from '@c/projectlist/ProjectList.vue';
</script>