게시판 첨부파일 드롭다운으로 수정

This commit is contained in:
kimdaae328 2024-12-17 14:59:54 +09:00
parent 2c4fe73842
commit 64241132ab
3 changed files with 36 additions and 40 deletions

View File

@ -11,7 +11,7 @@
<div class="w-100"> <div class="w-100">
<textarea <textarea
class="form-control" class="form-control"
placeholder="주제에 대한 생각을 자유롭게 댓글로 표현해 주세요. 여러분의 다양한 의견을 기다립니다." placeholder="주제에 대한 생각을 자유롭게 댓글로 표현해 주세요. &#13;&#10;여러분의 다양한 의견을 기다립니다."
rows="3" rows="3"
></textarea> ></textarea>
</div> </div>

View File

@ -1,47 +1,39 @@
<template> <template>
<div class="d-flex justify-content-between align-items-center flex-wrap mb-6 gap-2"> <div class="d-flex justify-content-between align-items-center flex-wrap mb-6 gap-2">
<!-- 제목 섹션 -->
<div class="me-1"> <div class="me-1">
<h5 class="mb-0">{{ boardTitle }}</h5> <h5 class="mb-0">{{ boardTitle }}</h5>
</div> </div>
<!-- <button type="button" class="btn btn-label-secondary"> <!-- 첨부파일 섹션 -->
<div v-if="dropdownItems.length > 0" class="btn-group">
<button type="button" class="btn btn-label-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa-solid fa-download me-2"></i> <i class="fa-solid fa-download me-2"></i>
첨부파일 첨부파일
(<span class="attachment-num">1</span>) (<span class="attachment-num">{{ dropdownItems.length }}</span>)
</button> -->
<div v-if="attachmentCount > 0" class="d-flex align-items-centermb-2">
<button type="button" class="btn btn-label-secondary">
<i class="fa-solid fa-download me-2"></i>
첨부파일
(<span class="attachment-num">{{ attachmentCount }}</span>)
</button> </button>
<ul class="dropdown-menu">
<li v-for="(item, index) in dropdownItems" :key="index">
<a class="dropdown-item" href="javascript:void(0);" @click="dropClick(item.action)">
{{ item.label }}
</a>
</li>
</ul>
</div> </div>
</div> </div>
<hr class="my-6"> <hr class="my-6">
<!-- 컨텐트 섹션 -->
<div class="d-flex min-150"> <div class="d-flex min-150">
<p class="mb-0">{{ boardContent }}</p> <p class="mb-0">{{ boardContent }}</p>
</div> </div>
<!-- 좋아요 섹션 -->
<div class="ms-auto text-end"> <div class="text-center">
<template v-if="showDetail"> <BoardRecommendBtn />
<button class="btn btn-label-primary btn-icon">
<i class='bx bx-edit-alt'></i>
</button>
<button class="btn btn-label-primary btn-icon ms-1">
<i class='bx bx-trash' ></i>
</button>
</template>
<template v-else>
<button class="btn btn-label-primary btn-icon">
<i class="fa-regular fa-thumbs-up"></i> <span class="num">1</span>
</button>
<button class="btn btn-label-danger btn-icon">
<i class="fa-regular fa-thumbs-down"></i> <span class="num">1</span>
</button>
</template>
</div> </div>
</template> </template>
<script setup> <script setup>
import BoardRecommendBtn from './BoardRecommendBtn.vue';
defineProps({ defineProps({
boardTitle : { boardTitle : {
type: String, type: String,
@ -55,23 +47,20 @@ defineProps({
type: Number, type: Number,
default: 0, default: 0,
}, },
showDetail: { dropdownItems: {
type: Boolean, type: Array,
default: false, default: () => [],
} },
}); });
const emit = defineEmits(['dropdown-click']);
const dropClick = (action) => {
emit('dropdown-click', action);
};
</script> </script>
<style scoped> <style scoped>
.min-150 { .min-150 {
min-height: 150px !important; min-height: 150px !important;
} }
.ms-auto button + button {
margin-left: 5px;
}
.num {
margin-left: 5px;
}
</style> </style>

View File

@ -7,7 +7,7 @@
<BoardProfile profileName="만드레야2"/> <BoardProfile profileName="만드레야2"/>
</div> </div>
<div class="card-body"> <div class="card-body">
<BoardContent boardTitle="제목1" boardContent="내용1" :attachmentCount="1" /> <BoardContent boardTitle="제목1" boardContent="내용1" :dropdownItems="dropdownItems" />
<BoardComentArea /> <BoardComentArea />
</div> </div>
<div class="card-footer"> <div class="card-footer">
@ -24,6 +24,13 @@ import BoardComentArea from '@/components/board/BoardComentArea.vue';
import BoardComment from '@/components/board/BoardComment.vue'; import BoardComment from '@/components/board/BoardComment.vue';
import BoardContent from '@/components/board/BoardContent.vue'; import BoardContent from '@/components/board/BoardContent.vue';
import BoardProfile from '@/components/board/BoardProfile.vue'; import BoardProfile from '@/components/board/BoardProfile.vue';
import { ref } from 'vue';
const dropdownItems = ref([
{ label: '내용1'},
{ label: '내용2'},
{ label: '내용3'},
]);
</script> </script>