Skip to content

Commit 6c04cb2

Browse files
committed
added information about the VFG events, reorganized the components into their own folder structure
1 parent 738505a commit 6c04cb2

File tree

6 files changed

+37
-1
lines changed

6 files changed

+37
-1
lines changed

SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* [Installation](installation.md)
55
* [Usage](usage.md)
66
* [Styling](styling.md)
7-
* [Component](component.md)
7+
* [Component](component/README.md)
88
* [Schema](schema.md)
99
* [Model](model.md)
1010
* [Options](options.md)

component.md renamed to component/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@
1616
| tag | `String` | "fieldset" | Change the main HTML element wrapper for Fields and Groups |
1717

1818

19+
## Events
1920

21+
| Property | Type | Default | Description |
22+
| :--- | :--- | :--- | :--- |
23+
| [validated](events.md) | `[...args]` | `none` | Fired when the form has finished validating |
24+
| [model-updated](events.md) | `]...args]` | `none` | Fired when the model has been updated |

component/events.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Schema
2+
3+
Events emitted by the [VFG Component](README.md)
4+
5+
## validated
6+
7+
This event is triggered whenever the form has completed validating. It provides the `boolean` result of this validation, any errors that may have occurred and a reference to the VFG component which triggered the validation.
8+
9+
Internally, the event is triggered with
10+
11+
```js
12+
this.$emit("validated", isValid, this.errors, this);
13+
```
14+
15+
`isValid` will contain a `boolean` value indicating whether the form is valid, `true` indicates the the validation succeeded. `false` indicates that it failed, and the errors array will contain any error messages from the validation rules.
16+
17+
You can listen for this by attaching to the `@validated` (`v-validated`) event on the `<vue-form-generator />` component.
18+
19+
20+
## model-updated
21+
22+
This event is triggered whenever the the model attached to the form has been updated, usually due to user interaction. It provides the new value and a reference to the field schema for the field which was just updated. This event is triggered each time a field is updated.
23+
24+
Internally, the event is triggered with
25+
```js
26+
this.$emit("model-updated", newVal, schema);
27+
```
28+
29+
`newVal` is the value that was just updated, and `schema` is a reference to the individual [field schema](schema.md). `schema` will only contain the individual field data, and not the full schema. This allows you to identify which field was just updated.
30+
31+
You can listen for this by attaching to the `@model-updated` (`v-model-updated`) event on the `<vue-form-generator />` component.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)