From d71db81856d47e7473a625c97a6db90ea52b6031 Mon Sep 17 00:00:00 2001 From: Dang Date: Fri, 14 Feb 2025 11:02:45 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9A=A9=EC=96=B4=EC=A7=91=20=EC=B9=B4?= =?UTF-8?q?=ED=85=8C=EA=B3=A0=EB=A6=AC=20=EB=93=B1=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/wordDict/DictWrite.vue | 14 +++++++------- src/views/wordDict/wordDict.vue | 25 +++++++++++++++++++------ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/components/wordDict/DictWrite.vue b/src/components/wordDict/DictWrite.vue index 985c69d..3f4fc83 100644 --- a/src/components/wordDict/DictWrite.vue +++ b/src/components/wordDict/DictWrite.vue @@ -5,7 +5,7 @@ - props.dataList.map(item => ({ - label: item.CMNCODNAM, - value: item.CMNCODVAL - })) -); +// const formattedDataList = computed(() => +// props.dataList.map(item => ({ +// label: item.CMNCODNAM, +// value: item.CMNCODVAL +// })) +// ); // 카테고리 입력 창 const showInput = ref(false); diff --git a/src/views/wordDict/wordDict.vue b/src/views/wordDict/wordDict.vue index 11cb320..fefb2ee 100644 --- a/src/views/wordDict/wordDict.vue +++ b/src/views/wordDict/wordDict.vue @@ -45,9 +45,9 @@ @@ -69,7 +69,7 @@ import DictCard from '@/components/wordDict/DictCard.vue'; import DictWrite from '@/components/wordDict/DictWrite.vue'; import DictAlphabetFilter from '@/components/wordDict/DictAlphabetFilter.vue'; - import commonApi from '@/common/commonApi' + import commonApi from '@/common/commonApi'; import { useToastStore } from '@s/toastStore'; const { appContext } = getCurrentInstance(); @@ -88,8 +88,12 @@ const total = ref(0); // 카테고리 - const { cateList } = commonApi(); + const { cateList } = commonApi({ + loadCateList: true + }); const selectedCategory = ref(''); + const selectCategory = ref(''); + //선택된 알파벳 const selectedAlphabet = ref(''); @@ -156,15 +160,24 @@ const addCategory = (data) =>{ const lastCategory = cateList.value[cateList.value.length - 1]; const newValue = lastCategory ? parseInt(lastCategory.CMNCODVAL) + 1 : 600101; + console.log('lastCategory',lastCategory) + console.log('newValue',newValue) + axios.post('worddict/insertCategory',{ CMNCODNAM: data }).then(res => { if(res.data.data == '1'){ + console.log('res.data.data',res.data.data) + toastStore.onToast('카테고리가 추가 등록 되었습니다.', 's'); const newCategory = { CMNCODNAM: data, CMNCODVAL: newValue.toString() }; - cateList.value.unshift(newCategory); + console.log('newCategory',newCategory) + + cateList.value.unshift(newCategory.CMNCODNAM); selectCategory.value = newCategory.CMNCODVAL; + console.log(' selectCategory.value', selectCategory.value) + } }) }