the root of the problem lies in my carelessness, but there is something wrong with the port check I wrote. In the end, the numeric range check is used, which is very simple. Thank you for your comments for your good ideas. Thank you all for your good ideas.
verify that the expression is correct on the online test tool, but it is wrong in the project, such as the test port number
let checkPort = (rule, value, callback) => {
if (value.length < = 0) {
return callback(new Error(""));
}
setTimeout(() => {
if (value == "" || typeof(value) == undefined) {
callback(new Error(""));
} else {
const re = /^[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]{1}|6553[0-5]$/;
const rsCheck = re.test(value);
if (!rsCheck) {
callback(new Error("[0-65535]"));
} else {
callback();
}
}
}, 1000);
(according to the great god who made the comments below, change! value to value.length, will appear the loading status that has been checked all the time) will be displayed as follows, feeling very toxic
.
value
is there any divine guidance