ElemeFE / ElemeFE/element

[Feature Request] Inject the form model into the custome validator function

Open
#19,554 2 comments 0 reactions 0 assignees View on GitHub
stale
Dominant language
Vue
Stars
54k
Forks
14.4k
PR merge metrics
No merged PRs in 30d

Description

### Existing Component

### Component Name
el-form

### Description
Without model in validator function, I have to use this.xxx or $refs to access the model itself. It's inconvenient when I use config-like style to write a form validation.Especially when the config and the form component codes are in different repos which communicate with server's json response.

e.g

in repo1 there's component's code:

```html

```

in repo2 there's form items' config:
```javascript
{
label: 'xxx',
rule: [
validator(rule, value, callback) {
// how to access another field's value? Can I still use "this" keyword?
}
]
}
```
I cannot access other fields in the scene like this.
Thank you.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.