input,el-autocomplete 框限制输入长度

<el-input
placeholder="请输入"
@input="inputChange"
type="number"
v-model="codeForm.phoneNum"
autocomplete="off"
></el-input>

inputChange(value) {
if (value.toString().length > 11) {
this.codeForm.phoneNum = this.codeForm.phoneNum.toString().slice(0, 11)
}
console.log(value);
},

posted @ 2022-03-29 13:47  诡道也  阅读(931)  评论(0编辑  收藏  举报