vux [Bug Report] input框获取焦点问题

xa9qqrwz  于 5个月前  发布在  其他
关注(0)|答案(1)|浏览(69)

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?

焦点在手动输入文字处

相关问题