용어어등록수정
This commit is contained in:
parent
de9c8d5638
commit
4962ff4c92
@ -166,56 +166,40 @@ 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);
|
||||
const existingCategory = props.dataList.find(item => item.label === valueTrim);
|
||||
|
||||
// 카테고리 입력시 공백
|
||||
if(valueTrim == ''){
|
||||
addCategoryAlert.value = true;
|
||||
if (existingCategory) {
|
||||
addCategoryAlert.value = true;
|
||||
|
||||
// 공백시 강제 focus
|
||||
setTimeout(() => {
|
||||
const inputElement = categoryInputRef.value?.$el?.querySelector('input');
|
||||
if (inputElement) {
|
||||
inputElement.focus();
|
||||
}
|
||||
}, 0);
|
||||
|
||||
|
||||
}else if (existingCategory) {
|
||||
addCategoryAlert.value = true;
|
||||
|
||||
// 중복시 강제 focus
|
||||
setTimeout(() => {
|
||||
const inputElement = categoryInputRef.value?.$el?.querySelector('input');
|
||||
if (inputElement) {
|
||||
inputElement.focus();
|
||||
}
|
||||
}, 0);
|
||||
|
||||
} else {
|
||||
addCategoryAlert.value = false;
|
||||
}
|
||||
// 중복 시 강제 focus
|
||||
setTimeout(() => {
|
||||
const inputElement = categoryInputRef.value?.$el?.querySelector('input');
|
||||
if (inputElement) {
|
||||
inputElement.focus();
|
||||
}
|
||||
}, 0);
|
||||
} else {
|
||||
addCategoryAlert.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user