VUX version
2.9.2
OS/Browsers version
ios,google
Vue version
2.6.10
Code
<x-input v-model.trim="account" type="tel" @on-blur="blurIn" ref="Phone Number" autocomplete="no" placeholder="Phone Number" @on-change="changeAccount" required>
<svg-icon type="shouji" slot="label"></svg-icon>
</x-input>
changeAccount (val) {
this.loginData.account = val;
if (val.length === 4) {
let value = `(${val.substr(0, 3)})${val.substr(-1)}`;
this.account = value;
this.$refs['Phone Number'].focus;
}
}
Steps to reproduce
如果输入框有值,js为其重新赋值,再自动获取焦点时,焦点不在文字最后。
What is Expected?
焦点在文字末尾处
What is actually happening?
焦点在手动输入文字处
1条答案
按热度按时间kr98yfug1#
同求