Skip to content

Commit 00999d2

Browse files
committed
Update README.md
1 parent 00c9554 commit 00999d2

File tree

1 file changed

+67
-1
lines changed

1 file changed

+67
-1
lines changed

README.md

+67-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,73 @@ https://github.com/icebob/vue-form-generator/archive/master.zip
3636
```
3737

3838
## Usage
39-
TODO
39+
Simply require it and add as a component:
40+
```js
41+
import VueFormGenerator from "vue-form-generator";
42+
43+
export default {
44+
...
45+
components: {
46+
VueFormGenerator: VueFormGenerator.component
47+
}
48+
...
49+
```
50+
51+
## Examples
52+
### Schema sample
53+
```js
54+
{
55+
fields: [{
56+
type: "text",
57+
label: "ID",
58+
model: "id",
59+
readonly: true,
60+
featured: false,
61+
disabled: true
62+
}, {
63+
type: "text",
64+
label: "Name",
65+
model: "name",
66+
readonly: false,
67+
featured: true,
68+
required: true,
69+
disabled: false,
70+
placeholder: "User's name",
71+
validator: VueFormGenerator.validators.string
72+
}, {
73+
type: "password",
74+
label: "Password",
75+
model: "password",
76+
min: 6,
77+
required: true,
78+
hint: "Minimum 6 characters",
79+
validator: VueFormGenerator.validators.string
80+
}, {
81+
type: "email",
82+
label: "E-mail",
83+
model: "email",
84+
placeholder: "User's e-mail address",
85+
validator: VueFormGenerator.validators.email
86+
}, {
87+
type: "checklist",
88+
label: "Skills",
89+
model: "skills",
90+
multi: true,
91+
required: true,
92+
multiSelect: true,
93+
values: ["HTML5", "Javascript", "CSS3", "CoffeeScript", "AngularJS", "ReactJS", "VueJS"]
94+
}, {
95+
type: "checkbox",
96+
label: "Status",
97+
model: "status",
98+
multi: true,
99+
readonly: false,
100+
featured: false,
101+
disabled: false,
102+
default: true
103+
}]
104+
}
105+
```
40106
41107
## Development
42108
This command will start a `webpack-dev-server` with content of `dev` folder.

0 commit comments

Comments
 (0)