vue-form-generator is a lightweight and easy-to-extend JSON form generator component based on the JSON schema of Vue.js, with support for custom styles and built-in field validation tools.
Features
- reactive forms based on schemas
- multiple object editing
- 21 field types
- built-in validators
- core & full bundles (41kb and 50kb gzipped)
- Bootstrap friendly templates
- customizable styles
- can be extended easily with custom fields
- …etc
How to make use of it:
Installation:
$ npm install vue-form-generator
Usage
<template> <div class="panel-body"> <vue-form-generator :schema="schema" :model="model" :options="formOptions"></vue-form-generator> </div> </template>
<script> import Vue from 'vue' import VueFormGenerator from 'vue-form-generator' import 'vue-form-generator/dist/vfg.css' Vue.use(VueFormGenerator) export default { data () { return { model: { id: 1, name: 'John Doe', password: 'J0hnD03!x4', skills: ['Javascript', 'VueJS'], email: '[email protected]', status: true }, schema: { fields: [ { type: 'input', inputType: 'text', label: 'ID (disabled text field)', model: 'id', readonly: true, disabled: true }, { type: 'input', inputType: 'text', label: 'Name', model: 'name', placeholder: 'Your name', featured: true, required: true }, { type: 'input', inputType: 'password', label: 'Password', model: 'password', min: 6, required: true, hint: 'Minimum 6 characters', validator: VueFormGenerator.validators.string }, { type: 'select', label: 'Skills', model: 'skills', values: ['Javascript', 'VueJS', 'CSS3', 'HTML5'] }, { type: 'input', inputType: 'email', label: 'E-mail', model: 'email', placeholder: 'User\'s e-mail address' }, { type: 'checkbox', label: 'Status', model: 'status', default: true } ] }, formOptions: { validateAfterLoad: true, validateAfterChanged: true, validateAsync: true } } } } </script>
import VueFormGenerator from "vue-form-generator"; //component javascript export default { components: { "vue-form-generator": VueFormGenerator.component } };
dynamic form generator for vue js, vue-form-generator Plugin/Github/Codepen
See Demo And Download
Official Website(vue-generators): Click Here
This superior jQuery/javascript plugin is developed by vue-generators. For extra advanced usage, please go to the official website.