代码如下:
<u-input v-model="paramsData.codeAndName" :placeholder="$t('common1.scan'||'请扫描')" :border="true"
@confirm="search($event)" :focus="firstFocus"></u-input>
//这部分是函数:
search(e) {
this.$http.get({
url: `/...`,
}).then(res => {
...
}).catch(err => {
}).finally(() => {
//清空输入框
this.paramsData.codeAndName = ''
//重新聚焦到输入框
this.firstFocus = false
this.$nextTick(() => {
this.firstFocus = true
})
})
}
0 个回复