didi / didi/cube-ui

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

Open
#356 1 comment 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
JavaScript
Stars
9.1k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

### What problem does this feature solve?
Validator添加自定义规则时候:
```javascript
Validator.addRule('odd', (val, config, type) => !config || Number(val) % 2 === 1)
Validator.addMessage('odd', 'Please input odd.')
```
显得比较蛋疼,最好能链式调用
```javascript
Validator.addRule('odd', (val, config, type) => !config || Number(val) % 2 === 1)
.addMessage('odd', 'Please input odd.')
```

显得比较优雅

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.