1、给input加上ref;
1 <v-otp-input 2 ref="inputName" 3 class="opt-input" 4 length="9" 5 type="number" 6 pattern="\d*" 7 v-model="payNum" 8 plain 9 ></v-otp-input>
2、一进来就执行放在mounted里;
1 mounted(){ 2 this.$nextTick(() => { 3 this.$refs.inputName.focus(); 4 }) 5 },
参考文档
https://www.cnblogs.com/clark1990/p/16498108.html
标签:vue,指定,框内,input,mounted,光标 From: https://www.cnblogs.com/tanweiwei/p/16934703.html