uniapp的输入框的focus光标自动聚焦:
this.focus = false;
this.$nextTick(() => {
this.focus = true;
});
但在focus实现后,输入框里内容置空后console是空的,但是,框中内容还在,无法自动清除,
没办法就直接用定时了
setTimeout(() => {
that.value = ''
}, 100)
所以,综上所述,PDA实现连续扫描全部代码:
<input class="input" v-model="value" :placeholder="placeholder" :disabled="disabled":focus="focus" :type="type" @input="onInput" @confirm="confirm" />
//JS
confirm: function(event) {
let that = this
that.value = ''
setTimeout(() => {
that.focus = false;
that.$nextTick(() => {
that.focus = true;
});
that.value = ''
}, 100)
},