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() } } }