didi/cube-ui

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

Open

#356 创建于 2018年11月26日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)JavaScript (9,088 star) (1,503 fork)batch import
help wanted

描述

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.')

显得比较优雅

贡献者指南

[New Feature] Validate扩展方法和类型能不能增加链式调用 · didi/cube-ui#356 | Good First Issue