From d9cbd2ff94dc1db2821c95bcb6c11ed922ec5cc3 Mon Sep 17 00:00:00 2001 From: jmal Date: Tue, 19 Mar 2024 16:35:56 +0800 Subject: [PATCH] style: tag edit --- src/components/TagDialog/index.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/TagDialog/index.vue b/src/components/TagDialog/index.vue index 1d018ae..71dda77 100644 --- a/src/components/TagDialog/index.vue +++ b/src/components/TagDialog/index.vue @@ -195,6 +195,11 @@ export default { } this.hasChange = true this.tags.push({ name: inputValue, color: this.defaultTagColor}); + // 查看existingTags中是否有相同的标签 + let index = this.existingTags.findIndex(item => item.name === inputValue) + if (index !== -1) { + this.existingTags.splice(index, 1) + } } this.inputVisible = false; this.inputValue = ''; @@ -222,6 +227,9 @@ export default { this.tagDialogVisible = false this.$emit('update:status', this.tagDialogVisible) this.isEditMode = false + this.inputVisible = false + this.inputValue = '' + this.tags = [] }, editMode() { this.isEditMode = !this.isEditMode