检查标签是否在下拉框中已存在

This commit is contained in:
670788339
2025-11-05 14:38:00 +08:00
parent a2640771fb
commit ef9e4a0f68

View File

@@ -230,6 +230,12 @@ export default {
this.$message.error('标签不能超过8个字')
return;
}
// 检查标签是否在下拉框中已存在
const isExistInSearch = this.searchResults.some(tag => tag.tagName === tagName);
if (isExistInSearch) {
this.$message.warning('已存在此标签,请选择');
return;
}
// 首先检查是否与已选择的标签重复
const isDuplicate = this.selectedTags.some(tag => tag.tagName === tagName);
if (isDuplicate) {