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 }}