mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-08 18:36:43 +08:00
检查标签是否在下拉框中已存在
This commit is contained in:
@@ -230,6 +230,12 @@ export default {
|
|||||||
this.$message.error('标签不能超过8个字')
|
this.$message.error('标签不能超过8个字')
|
||||||
return;
|
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);
|
const isDuplicate = this.selectedTags.some(tag => tag.tagName === tagName);
|
||||||
if (isDuplicate) {
|
if (isDuplicate) {
|
||||||
|
|||||||
Reference in New Issue
Block a user