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