【发布时间】:2021-04-30 09:05:12
【问题描述】:
我在 Vue 中有一个表单,它有一些组合输入,用于电话号码输入的样式原因。我的问题是用户必须点击标签才能转到电话号码的下一个输入字段。有没有办法检查当前和输入的最大长度,当满足时转到下一个输入?
<div class="combined-input combined-input--phone" :class="{'error--input': phoneInvalid('patientInformation')}">
<div class="open-parenthesis"></div>
<input type="text" id="phoneArea" maxlength="3" @blur="$v.formData.patientInformation.phone.$touch()" v-model.trim="$v.formData.patientInformation.phone.area.$model">
<div class="close-parenthesis"></div>
<input type="text" id="phoneA" maxlength="3" @blur="$v.formData.patientInformation.phone.$touch()" v-model.trim="$v.formData.patientInformation.phone.a.$model">
<div class="dash"></div>
<input type="text" id="phoneB" maxlength="4" @blur="$v.formData.patientInformation.phone.$touch()" v-model.trim="$v.formData.patientInformation.phone.b.$model">
</div>
【问题讨论】:
标签: javascript html vue.js nuxt.js vuelidate