From 62c97e0a1820256930677946850ffa9063d936f0 Mon Sep 17 00:00:00 2001 From: Dang Date: Mon, 17 Feb 2025 15:04:56 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9A=A9=EC=96=B4=EC=A7=91=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/input/FormSelect.vue | 26 +++-- src/components/wordDict/DictCard.vue | 157 +++++++++++++++++++------- src/components/wordDict/DictWrite.vue | 19 ++-- src/views/wordDict/wordDict.vue | 6 +- 4 files changed, 149 insertions(+), 59 deletions(-) diff --git a/src/components/input/FormSelect.vue b/src/components/input/FormSelect.vue index 2ff0c3a..04b88f6 100644 --- a/src/components/input/FormSelect.vue +++ b/src/components/input/FormSelect.vue @@ -40,26 +40,26 @@ const props = defineProps({ required: true, }, value: { - type: String, + type: [String, Number], default: '0', require: false, }, - isAlert : { + isAlert: { type: Boolean, default: false, required: false, }, - isLabel : { + isLabel: { type: Boolean, default: true, required: false, }, - isRow : { + isRow: { type: Boolean, default: true, required: false, }, - isCommon : { + isCommon: { type: Boolean, default: false, required: false, @@ -69,11 +69,19 @@ const props = defineProps({ const emit = defineEmits(['update:data']); const selectData = ref(props.value); -// data 변경 감지 +// props.value의 변경을 감지하는 watch 추가 +watch(() => props.value, (newValue) => { + selectData.value = newValue; +}, { immediate: true }); + +// data 변경 감지 수정 watch(() => props.data, (newData) => { if (props.isCommon && newData.length > 0) { - selectData.value = newData[0].value; - emit('update:data', selectData.value); + // value prop이 '0'(기본값)일 때만 첫번째 아이템 선택 + if (props.value === '0') { + selectData.value = newData[0].value; + emit('update:data', selectData.value); + } } }, { immediate: true }); @@ -81,4 +89,4 @@ watch(() => props.data, (newData) => { watch(selectData, (newValue) => { emit('update:data', newValue); }); - + \ No newline at end of file diff --git a/src/components/wordDict/DictCard.vue b/src/components/wordDict/DictCard.vue index 9e3dd34..4d9b5da 100644 --- a/src/components/wordDict/DictCard.vue +++ b/src/components/wordDict/DictCard.vue @@ -1,69 +1,146 @@ + +.edit-btn { + position: absolute; + right: 0.7rem; + top: 1.2rem; +} + \ No newline at end of file diff --git a/src/components/wordDict/DictWrite.vue b/src/components/wordDict/DictWrite.vue index 3f4fc83..dc30972 100644 --- a/src/components/wordDict/DictWrite.vue +++ b/src/components/wordDict/DictWrite.vue @@ -9,6 +9,7 @@ :is-common="true" @update:data="selectCategory = $event" @change="onChange" + :value="formValue" />
@@ -34,11 +35,13 @@ name="word" :is-essential="true" :is-alert="wordTitleAlert" + :modelValue="titleValue" @update:modelValue="wordTitle = $event" />
+ {{ contentValue }}