如何验证vuetify规则中的数字



我需要添加数字规则,比如数字应该在1 to 100&111, 222, 333, 444, 555, 666, 777, 888, 999, 1000

我已经制定了从1到100 的规则

rules: {
amount: v => {
if (!v.trim()) return true;
if (!isNaN(parseFloat(v)) && v >= 0 && v <= 100) return true;
return "Number has to be between 0 and 100";
}
},

但是如何验证111到999的唯一号码

您接受因子111的数字。

let num = 111;
if (num < 1000) {
if (Number.isInteger(num / 111)) {
console.log(true);
} else {
console.log(false)
}
} else {
// create the validation rules for the numbers that bigger than 999
}

最新更新