UNPKG

@hmtech/form_engine

Version:

表单引擎,基于ant-design-vue

59 lines (58 loc) 1.49 kB
export default [ { label: '数字', type: 'number', validator(rule, value, callback) { const tempReg = /^[0-9]*$/ if (!tempReg.test(value)) callback('格式错误,字符需为数字') callback() }, }, { label: '正整数', type: 'integer', validator(rule, value, callback) { const tempReg = /^[1-9]\d*$/ if (!tempReg.test(value)) callback('格式错误,字符需为正整数') callback() }, }, // { // label: '浮点数', // type: 'float', // validator(rule, value, callback) { // // const tempReg = // // // if (!tempReg.test(value)) callback('格式错误,字符需为最多2位小数的数字') // callback() // }, // }, { label: '域名', type: 'url', message: '格式错误,字符需为域名', }, { label: '邮箱', type: 'email', message: '格式错误,字符需为邮箱', }, { label: '手机号码', type: 'phone', validator(rule, value, callback) { const tempReg = /^1\d{10}$/ if (!tempReg.test(value)) callback('格式错误,字符需为手机号码') callback() }, }, // { // // 座机号码 OR 手机号码 // label: '联系电话', // type: 'contact', // validator(rule, value, callback) { // // const tempReg = // // // if (!tempReg.test(value)) callback('格式错误,字符需为手机号码或座机号码') // callback() // }, // }, ]