|
1 | 1 | # element-form-builder
|
2 | 2 |
|
3 |
| -Build form of element-ui using JSON configuration. |
| 3 | +[](https://www.npmjs.com/package/element-form-builder) |
| 4 | +[](https://www.npmjs.com/package/element-form-builder) |
| 5 | +[](https://www.npmjs.com/package/element-form-builder) |
| 6 | + |
| 7 | +Build element-ui forms with JSON schema. |
| 8 | + |
| 9 | +:us: English | [:cn: 简体中文](README.zh-CN.md) |
| 10 | + |
| 11 | +## Example |
| 12 | + |
| 13 | +[:zap: Live Preview](https://element-form-builder.now.sh) | [:book: Docs](https://codetrial.github.io/element-form-builder) |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | +## Quick Start |
| 18 | + |
| 19 | +First you need to have an element-ui project. If not, it is recommended to create one quickly using the preset below. |
| 20 | + |
| 21 | +```bash |
| 22 | +vue create --preset codetrial/vue-cli-plugin-element your-project |
| 23 | +``` |
| 24 | + |
| 25 | +### Install |
| 26 | + |
| 27 | +```bash |
| 28 | +yarn add element-form-builder |
| 29 | +# OR |
| 30 | +npm i element-form-builder |
| 31 | +``` |
| 32 | + |
| 33 | +### Registry |
| 34 | + |
| 35 | +```javascript |
| 36 | +import FormBuilder from 'element-form-builder' |
| 37 | + |
| 38 | +Vue.use(FormBuilder) |
| 39 | +``` |
| 40 | + |
| 41 | +### Witness the miracle moment |
| 42 | + |
| 43 | +Vue template: |
| 44 | + |
| 45 | +```html |
| 46 | +<el-form-builder :config="formConfig" v-model="formValues" label-width="80px"> |
| 47 | +</el-form-builder> |
| 48 | +``` |
| 49 | + |
| 50 | +Vue component: |
| 51 | + |
| 52 | +```javascript |
| 53 | +export default { |
| 54 | + data() { |
| 55 | + return { |
| 56 | + formValues: { |
| 57 | + title: 'Some Awesome Title' |
| 58 | + }, |
| 59 | + |
| 60 | + formConfig: { |
| 61 | + rules: { |
| 62 | + title: [{ required: true, message: 'Please enter the title' }] |
| 63 | + }, |
| 64 | + elements: [ |
| 65 | + { |
| 66 | + tag: 'el-input', |
| 67 | + item: { |
| 68 | + label: 'Title' |
| 69 | + }, |
| 70 | + detail: { |
| 71 | + name: 'title' |
| 72 | + } |
| 73 | + } |
| 74 | + ] |
| 75 | + } |
| 76 | + } |
| 77 | + } |
| 78 | +} |
| 79 | +``` |
| 80 | + |
| 81 | +## Core Features |
| 82 | + |
| 83 | +- :camera: Any Component |
| 84 | +- :tv: Form Validation |
| 85 | +- :watch: Form Model |
| 86 | +- :radio: Custom Slot |
| 87 | + |
| 88 | +## Contributing |
| 89 | + |
| 90 | +Looking forward to your pull requests. |
| 91 | + |
| 92 | +## Built With |
| 93 | + |
| 94 | +- [Vue.js](https://github.com/vuejs/vue) |
| 95 | +- [ElementUI](https://github.com/ElemeFE/element) |
| 96 | + |
| 97 | +## License |
| 98 | + |
| 99 | +[MIT](http://opensource.org/licenses/MIT) |
| 100 | + |
| 101 | +Copyright (c) 2018 - present, Felix Yang |
0 commit comments