diff --git a/src/components/Course/courseTag.vue b/src/components/Course/courseTag.vue index 176435c9..3514772d 100644 --- a/src/components/Course/courseTag.vue +++ b/src/components/Course/courseTag.vue @@ -172,7 +172,7 @@ export default { console.log('开始回车创建 = ' + event.target.value) const inputVal = event.target.value?.trim() console.log('回车创建 inputVal= ' + inputVal) - this.clearInput(); + // this.clearInput(); console.log('回车创建中 先清文字 inputVal = ' + inputVal) if (!inputVal) return; @@ -214,11 +214,18 @@ export default { }, clearInput() { - if (this.$refs.tagSelect) { + /*if (this.$refs.tagSelect) { const input = this.$refs.tagSelect.$refs.input; if (input) { input.value = ''; } + }*/ + // 方案1:通过 ref 直接操作 el-select 的输入框 + if (this.$refs.tagSelect) { + const input = this.$refs.tagSelect.$el.querySelector('input'); + if (input) { + input.value = ''; + } } },