Merge branch 'khj'
This commit is contained in:
commit
69887a798f
@ -166,39 +166,26 @@ const saveWord = () => {
|
||||
}
|
||||
const wordData = {
|
||||
id: props.NumValue || null,
|
||||
title: computedTitle.value,
|
||||
title: computedTitle.value.trim(),
|
||||
category: selectedCategory.value,
|
||||
content: content.value,
|
||||
};
|
||||
if(valid){
|
||||
emit('addWord', wordData, addCategory.value === ''
|
||||
emit('addWord', wordData, addCategory.value.trim() === ''
|
||||
? (isNaN(selectedCategory.value) ? selectedCategory.value : Number(selectedCategory.value))
|
||||
: addCategory.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 카테고리 focusout 이벤트 핸들러 추가
|
||||
const handleCategoryFocusout = (value) => {
|
||||
|
||||
if (!value || value.trim() === '') {
|
||||
return;
|
||||
}
|
||||
const valueTrim = value.trim();
|
||||
if(value){
|
||||
const existingCategory = props.dataList.find(item => item.label === valueTrim);
|
||||
|
||||
// 카테고리 입력시 공백
|
||||
if(valueTrim == ''){
|
||||
addCategoryAlert.value = true;
|
||||
|
||||
// 공백시 강제 focus
|
||||
setTimeout(() => {
|
||||
const inputElement = categoryInputRef.value?.$el?.querySelector('input');
|
||||
if (inputElement) {
|
||||
inputElement.focus();
|
||||
}
|
||||
}, 0);
|
||||
|
||||
|
||||
}else if (existingCategory) {
|
||||
if (existingCategory) {
|
||||
addCategoryAlert.value = true;
|
||||
|
||||
// 중복 시 강제 focus
|
||||
@ -208,14 +195,11 @@ const handleCategoryFocusout = (value) => {
|
||||
inputElement.focus();
|
||||
}
|
||||
}, 0);
|
||||
|
||||
} else {
|
||||
addCategoryAlert.value = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user