From 5afd1bc1dbae59c1b1f9b29ce4a1a191fb2c63af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E7=8E=B2?= <8702040+cai-ling@user.noreply.gitee.com> Date: Thu, 17 Oct 2024 15:34:20 +0800 Subject: [PATCH] no message --- src/components/SearchBox3.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/SearchBox3.vue b/src/components/SearchBox3.vue index 1922afb..996afae 100644 --- a/src/components/SearchBox3.vue +++ b/src/components/SearchBox3.vue @@ -8,6 +8,8 @@ ref="input" :placeholder="placeholder" :value="value" + :focus="focusState" + :readOnly="readOnly" @focus="handleFocus" @blur="handleBlur" @input="handleSend"> @@ -43,7 +45,6 @@ export default { }, methods: { handleFocus () { - this.$refs.input.focus() this.focusState = true }, handleBlur (e) { @@ -55,6 +56,12 @@ export default { if (e.target.value.length) { this.$emit('handleChange', e.target.value) } + this.focusState = false + this.readOnly = true + setTimeout(() => { + this.readOnly = false + }, 200) + this.$refs.input.blur() } } }