From e61bcd20ce1956dd89b3d8f68c7e9ca896423f3a Mon Sep 17 00:00:00 2001 From: Dang Date: Thu, 6 Feb 2025 16:16:25 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9A=A9=EC=96=B4=EC=A7=91=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/category/CategoryBtn.vue | 11 ++++++ src/components/wordDict/DictWrite.vue | 49 ++++++++++++++++++------- src/views/wordDict/wordDict.vue | 31 ++++++++++++++-- 3 files changed, 74 insertions(+), 17 deletions(-) diff --git a/src/components/category/CategoryBtn.vue b/src/components/category/CategoryBtn.vue index c98ea10..ee8a618 100644 --- a/src/components/category/CategoryBtn.vue +++ b/src/components/category/CategoryBtn.vue @@ -43,4 +43,15 @@ const selectCategory = (cate) => { .cate-list { margin-left: -0.25rem; } + +@media (max-width: 768px) { + .cate-list { + overflow-x: scroll; + flex-wrap: nowrap !important; + + li { + flex: 0 0 auto; + } + } +} \ No newline at end of file diff --git a/src/components/wordDict/DictWrite.vue b/src/components/wordDict/DictWrite.vue index 3fd2826..eccf5a3 100644 --- a/src/components/wordDict/DictWrite.vue +++ b/src/components/wordDict/DictWrite.vue @@ -7,11 +7,15 @@ :is-common="true" @update:data="selectCategory = $event" @change="onChange" - /> - + /> + + +
- +
@@ -22,10 +26,13 @@ :is-essential="true" :is-alert="wordTitleAlert" @update:modelValue="wordTitle = $event" - />
+ /> +
- - + +
@@ -36,19 +43,21 @@ import { defineProps, computed, ref, defineEmits } from 'vue'; import QEditor from '@/components/editor/QEditor.vue'; import FormInput from '@/components/input/FormInput.vue'; import FormSelect from '@/components/input/FormSelect.vue'; +import PlusBtn from '../button/PlusBtn.vue'; const emit = defineEmits(['close','addCategory','addWord']); //용어제목 -const wordTitle =ref(''); -const addCategory =ref(''); +const wordTitle = ref(''); +const addCategory = ref(''); const content = ref(''); const imageUrls = ref([]); //용어 Vaildation용 const wordTitleAlert = ref(false); -const addcateAlert =ref(false); +const wordContentAlert = ref(false); const addCategoryAlert = ref(false); + //선택 카테고리 const selectCategory = ref(''); @@ -77,27 +86,41 @@ const toggleInput = () => { // 카테고리 저장 const saveInput = () => { - if( addCategory.value == ''){ + if(addCategory.value == ''){ addCategoryAlert.value = true; return; } - console.log('입력값 저장됨!',addCategory.value); + // console.log('입력값 저장됨!',addCategory.value); emit('addCategory', addCategory.value); showInput.value = false; }; const onChange = (newValue) => { - selectCategory.value =newValue.target.value; + selectCategory.value = newValue.target.value; }; //용어 등록 const saveWord = () => { - //validation 체크후 emit전송 수정해야함 + //validation + + // 용어 체크 + if(wordTitle.value == ''){ + wordTitleAlert.value = true; + return; + } + + // 내용 체크 + if(content.value == ''){ + wordContentAlert.value = true; + return; + } + const wordData = { title: wordTitle.value, category: selectCategory.value, content: content.value, }; + emit('addWord', wordData); }; diff --git a/src/views/wordDict/wordDict.vue b/src/views/wordDict/wordDict.vue index a6c209b..36a8641 100644 --- a/src/views/wordDict/wordDict.vue +++ b/src/views/wordDict/wordDict.vue @@ -30,7 +30,7 @@
- +
@@ -61,7 +61,7 @@