@pyramid-kit/util
TypeScript icon, indicating that this package has built-in type declarations

0.4.0-alpha.3 • Public • Published

@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: ''
  }
}}

Readme

Keywords

none

Package Sidebar

Install

npm i @pyramid-kit/util

Weekly Downloads

0

Version

0.4.0-alpha.3

License

ISC

Unpacked Size

31.5 kB

Total Files

21

Last publish

Collaborators

  • guccihuiyuan