diff --git a/src/components/Course/courseTag.vue b/src/components/Course/courseTag.vue index bfa95a85..b4e682ff 100644 --- a/src/components/Course/courseTag.vue +++ b/src/components/Course/courseTag.vue @@ -169,7 +169,12 @@ export default { //按回车键,创建新标签 handleEnterKey(event) { + console.log('开始回车创建 = ' + event.target.value) const inputVal = event.target.value?.trim() + console.log('回车创建 inputVal= ' + inputVal) + this.clearInput(); + console.log('回车创建中 先清文字 inputVal = ' + inputVal) + if (!inputVal) return; // 检查是否与已选择的标签重复 const isDuplicate = this.selectedTags.some(tag => tag.tagName === inputVal); @@ -204,8 +209,8 @@ export default { this.previousTags = [...newValues]; this.$emit('change', this.displayTags); console.log('-- handleSelectionChange clearInput --- this.$refs.tagSelect = ' + this.$refs.tagSelect ) - console.log('-- handleSelectionChange clearInput --- input.value = ' + this.$refs.tagSelect.$refs.input ) this.clearInput(); + console.log('-- handleSelectionChange clearInput --- input.value = ' + this.$refs.tagSelect.$refs.input ) }, clearInput() {