The input box uses regular expressions to check the input value, and the tree point is deleted when it is deleted.

use the custom verification rules in elementui"s form to check the input numbers, but when you delete using the Backoff / Delete key, the decimal point is deleted together. I don"t know why, but regular expressions can currently meet the verification requirements. I don"t know if regularities are relevant. The code is as follows

let fnArgCheckDutyPercent = (rule, value, callback) => {
      let regDecimal = /^[\d{1,3}]+(\.\d{1,2})?$/;
      if (!value) {
        callback(new Error(""));
      } else if (!regDecimal.test(value)) {
        callback(new Error(""));
      } else {
        callback();
      }
    };
{ validator: fnArgCheckDutyPercent, trigger: "blur" }

the


problem has been solved because model in the template template adds the number modifier, 123. Will be automatically converted to


the first big shot has already raised a question.
regDecimal = / ^ [d {1Magne 3}] + (.d {1jue 2})? $/
change it to: regDecimal = / ^ d + (.d {1jue 2})? $/

clipboard.png

Menu