@pyramid-kit/util
v0.4.0-alpha.3
Published
``` // 表单 import {validateService} from './validate'; {getFieldDecorator(`roleName`, { initialValue: '', rules: [ { required: true, message: '必填', },
Downloads
6
Readme
@pyramid-kit/util
validate
// 表单
import {validateService} from './validate';
{getFieldDecorator(`roleName`, {
initialValue: '',
rules: [
{
required: true,
message: '必填',
},
validateService.emptyChar,
],
})(<Input placeholder="请输入" />)}
// 如果验证规则不够用或者 @pyramid-kit/util 不能及时更新,建议在项目里继承该工具暴露的接口来扩展使用
import { IValidateService, validateService } from './validate';
interface IValidateConfig extends IValidateService {
testChar: {
message: string;
pattern: string; // or validator?: (rule: any, value: any, callback: any, source?: any, options?: any) => void;
}
}
export const VALIDATE_CONFIG: IValidateConfig = {...validateService, {
testChar: {
message: '',
pattern: ''
}
}}