// 表单校验
        rules: {
          classHours:[
             {"pattern": /^[0-9]*$/,"message": "只能输入正整数"}
          ],
        },

代码

<el-input v-model="form.classHours" @keyup.native="ceshi(this)" style="width:80px"/>
ceshi(val){
        this.form.classHours = this.form.classHours.replace(/\D/g, '');
		    if(this.form.classHours ==0){
			      this.form.classHours = '';
		      }
      },
Logo

前往低代码交流专区

更多推荐