Skip to content

Commit 4bfeafa

Browse files
committed
Add documentation for 'eventProp'
1 parent f642456 commit 4bfeafa

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* [dynamicOptions](api/ui-schema/field/dynamic-options.md)
1515
* [errorHandler](api/ui-schema/field/error-handler.md)
1616
* [errorOptions](api/ui-schema/field/error-options.md)
17+
* [eventProp](api/ui-schema/field/event-prop.md)
1718
* [fieldOptions](api/ui-schema/field/field-options.md)
1819
* [attrs](api/ui-schema/field/field-options/attrs.md)
1920
* [class](api/ui-schema/field/field-options/class.md)

docs/api/ui-schema/field.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ A `field` is an `object` and must have a [component](field/component.md) propert
1212
* [dynamicOptions](field/dynamic-options.md)
1313
* [errorHandler](field/error-handler.md)
1414
* [errorOptions](field/error-options.md)
15+
* [eventProp](field/event-prop.md)
1516
* [fieldOptions](field/field-options.md)
1617
* [valueProp](field/value-prop.md)
1718

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Event prop
2+
3+
Sets which property should be emitted as the field's value when the component emits an event which is based on the [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event) interface. The property specified by `eventProp` is read from the event's `target` property, i.e. `event.target[eventProp]`. Default value is `value`, i.e. `event.target['value']`.
4+
5+
## Set globally for all fields
6+
7+
```js
8+
data() {
9+
return {
10+
options: {
11+
eventProp: 'target.href'
12+
}
13+
}
14+
}
15+
```
16+
17+
## Set locally for one field
18+
19+
```js
20+
data() {
21+
return {
22+
uiSchema: [{
23+
component: 'input',
24+
model: 'isChecked',
25+
eventProp: 'checked',
26+
valueProp: 'checked',
27+
fieldOptions: {
28+
type: "checkbox",
29+
on: ['input']
30+
}
31+
}]
32+
33+
}
34+
}
35+
```

0 commit comments

Comments
 (0)