html
<input type="number" class="form-control" oninput="intValidator(event)" v-model="dict.orderNum" placeholder="排序号"/>
js:
function intValidator(e){
var value = e.target.value;
value = value.replace( /\D+/, "");
if(value.length > 0){
if(value.length > 1 && value[0] == 0){
e.target.value = value.substring(1, value.length);
return;
}
//判断不要超过9位
if(value.length>9){
e.target.value=value.slice(0,9)
}else{
e.target.value = value;
}
}else{
e.target.value = 0;
};
}