form-create
A form generation component that can generate dynamic rendering, data colle...
README
form-create
Form builder with dynamic rendering, data collection, validation and submission capabilities, built-in 17 common form components, support for two-way data binding, event extension, and support for building built-in components and any vue components using json.
Support
- iViewUI 2.13.0+
- iViewUI 3.x
- ElementUI 2.5.2+
If it helps, you can click on "Star" in the upper right corner. Thank you!
The project is still being developed and improved. If there are any 'recommendations or questions, please ask here
Docs
Files
Name | Description |
---|---|
------------------ | -------- |
form-create.js | iViewUI |
form-create.elm.js | ElementUI |
Example
Legend
Install
- ``` sh
- npm install form-create
- ```
Import
CDN:
iviewUI
- ``` html
- <script src="//vuejs.org/js/vue.min.js"></script>
- <link rel="stylesheet" href="//unpkg.com/iview/dist/styles/iview.css">
- <script src="//unpkg.com/iview/dist/iview.min.js"></script>
- <script src="//unpkg.com/form-create/dist/form-create.min.js"></script>
- ```
elementUI
- ``` html
- <script src="//vuejs.org/js/vue.min.js"></script>
- <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
- <script src="https://unpkg.com/element-ui/lib/index.js"></script>
- <script src="//unpkg.com/form-create/dist/form-create.elm.min.js"></script>
- ```
NodeJs:
iviewUI
- ``` js
- import formCreate from 'form-create'
- import { maker } from 'form-create'
- Vue.use(formCreate)
- ```
ElementUI
- ``` js
- import formCreate from 'form-create/element'
- import { maker } from 'form-create/element'
- Vue.use(formCreate)
- ```
Usage
- ``` html
- <form-create ref="fc" v-model="fApi" :rule="rule" :option="option"></form-create>
- ```
NodeJs
- ``` js
- import {maker} from 'form-create'
- export default {
- data () {
- return {
- fApi:{},
- model: {},
- rule:[
- maker.input('goods_name','goods_name'),
- maker.date('create_at','created_at')
- ],
- option:{
- onSubmit:function (formData) {
- alert(JSON.stringify(formData));
- }
- }
- };
- },
- mounted:function(){
- this.model = this.fApi.model();
- }
- };
- ```
Browser
- ``` js
- new Vue({
- el:'#app1',
- data:{
- fApi:{},
- model: {},
- rule:[
- formCreate.maker.input('goods_name','goods_name'),
- formCreate.maker.date('create_at','created_at')
- ],
- option:{
- onSubmit:function (formData) {
- alert(JSON.stringify(formData));
- }
- }
- },
- mounted:function () {
- this.model = this.fApi.model();
- }
- });
- ```
Reference
- Vue
- iViewUI
Thank
Donation
Contact
email : xaboy2005@qq.com
License
Copyright (c) 2018-present xaboy