Verify that it is a regular corn expression,

<el-form-item label="Corn expression :" :label-width="formLabelWidth" prop="cronExpression">
              <el-input class="col-sm-10" v-model="qualityTaskManageForm.cronExpression"
                        placeholder="Please enter corn expression"></el-input>
            </el-form-item>
// Add rules to the form definition. Prop corresponds to the name in rules;
rules: {
  cronExpression:[
{required:true.validator:handleCronValidate,trigger: 'blur']}},// Define a handleCronValidate method directly in data, level with return
data() {
// Check whether it is a CRon expression
    var handleCronValidate=(rule,value,callback) = >{
  if(!!!!! value){let parser=require('cron-parser');
    try{
      let interval=parser.parseExpression(value);
      console.log("cronDate:",interval.next().toDate());
    } catch (e) {
      callback("Non-cron expression format, please check!"+e.message); }}else {
    callback("Cron expressions cannot be empty!");
  }
  callback();
};
}
Copy the code

!!!!!!!!! Prerequisite:

Have to go to the cron – parser official documents www.npmjs.com/package/cro… To convert the cron parser, run the following command:

npm i cron-parser
Copy the code

NPM install;

There are various ways to define validation rules. If you do not know, please refer to this article: blog.csdn.net/weixin_4397…