File tree Expand file tree Collapse file tree 1 file changed +14
-82
lines changed Expand file tree Collapse file tree 1 file changed +14
-82
lines changed Original file line number Diff line number Diff line change 11# Vue 3 Form Generator
2- A schema-based form generator component for Vue 3, based on ` vue-form-generator `
2+ A schema-based form generator component for Vue 3, based on the original
3+ [ ` vue-form-generator ` ] ( https://github.com/vue-generators/vue-form-generator ) library.
34
4- ## Basic usage
5- 1 . Install plugin in your Vue app, this will make all necessary components globally available in your app.
6- ``` javascript
7- // ...
5+ You can find documentation on the [ documentation page] ( https://kevinkosterr.github.io/vue3-form-generator-docs ) .
86
9- import VueFormGenerator from ' @kevinkosterr/vue3-form-generator'
10-
11- app .use (VueFormGenerator)
12-
13- // ...
7+ ## Building for development
8+ 1 . Install the dependencies
9+ ``` bash
10+ yarn install
1411```
15- 2 . Define a schema inside your Vue component
16- <br ><br >
17- #### Composition API:
18- ``` vue
19- <template>
20- <vue-form-generator :schema="form.schema" :model="form.model"/>
21- </template>
22-
23- <script setup>
24- import { ref } from 'vue'
25-
26- const form = ref({
27- model: {
28- name: '',
29- terms: false,
30- },
31- schema: {
32- fields: [
33- {
34- name: 'name',
35- label: 'Name',
36- type: 'input',
37- inputType: 'text',
38- model: 'name',
39- placeholder: "Write name...",
40- readonly: false,
41- required: true,
42- },
43- {
44- name: 'terms',
45- label: 'Accept terms and conditions',
46- type: 'input',
47- inputType: 'checkbox',
48- model: 'terms',
49- }
50- ]
51- }
52- })
53- </script>
12+ 2 . Create a schema inside the playground folder, for this you can copy ` schema.example.js ` .
13+ ``` bash
14+ cp playground/schema.example.js playground/schema.js
5415```
55- #### Options API:
56- ``` vue
57- <template>
58- <vue-form-generator :schema="form.schema" :model="form.model"/>
59- </template>
60-
61- <script>
62- export default {
63- data () {
64- return {
65- form: {
66- model: {
67- name: '',
68- },
69- schema: {
70- fields: [
71- {
72- name: 'name',
73- label: 'Name',
74- type: 'input',
75- inputType: 'text',
76- model: 'name',
77- placeholder: "Write name...",
78- readonly: false,
79- required: true,
80- }
81- ]
82- }
83- }
84- }
85- }
86- }
87- </script>
16+ 3 . Run the development playground
17+ ``` bash
18+ yarn run dev
8819```
8920
21+
You can’t perform that action at this time.
0 commit comments