https://www.cnblogs.com/whycai/p/11453533.html
背景:使用 input输入框时想限制输入的长度, type = "number" 时,maxlength无效,代码如下
1 <el-input v-model="form.tele" maxlength="11" placeholder="请输入账号"
type="number"></el-input>
查阅了相关资料后,换了种方式,问题解决
oninput="if(value.length>11) value=value.slice(0,11)"
<el-input v-model="form.tele" oninput="if(value.length>11)value=value.slice(0,11)"
type="number"></el-input>
网友评论