didi/cube-ui

[New Feature] Validate扩展方法和类型能不能增加链式调用

Open

#356 aberto em 26 de nov. de 2018

Ver no GitHub
 (1 comment) (0 reactions) (0 assignees)JavaScript (9.088 stars) (1.503 forks)batch import
help wanted

Description

What problem does this feature solve?

Validator添加自定义规则时候:

Validator.addRule('odd', (val, config, type) => !config || Number(val) % 2 === 1)
Validator.addMessage('odd', 'Please input odd.')

显得比较蛋疼,最好能链式调用

Validator.addRule('odd', (val, config, type) => !config || Number(val) % 2 === 1)
.addMessage('odd', 'Please input odd.')

显得比较优雅

Guia do colaborador