Merge branch 'khj'

This commit is contained in:
khj0414 2025-03-17 13:56:47 +09:00
commit 69887a798f

View File

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