vue数字验证

showAddFieldModelRule: {
name: [
{ required: true, message: '请填写表头名称', trigger: 'blur' }
],
index: [
{ required: true, message: '请填写排序号', trigger: 'blur' },
{ type: 'number', message: '必须是数字,且数字>=30', min:30, trigger: 'blur' }
]
}

<el-form-item label="排序数:" prop="index" >
<el-input type="text" v-model.number="showAddFieldModel.index" style="width:70%" clearable></el-input>
</el-form-item>


2.
{ type: 'string', pattern: '^[0-9]*$', message: '只能输入正整数', trigger: 'blur' }

 



posted @ 2022-11-23 10:41  君子笑而不语  阅读(469)  评论(0编辑  收藏  举报