|
| 1 | +# JSON Forms - More Forms. Less Code |
| 2 | + |
| 3 | +_Complex Forms in the blink of an eye_ |
| 4 | + |
| 5 | +JSON Forms eliminates the tedious task of writing fully-featured forms by hand by leveraging the capabilities of JSON, JSON Schema and Javascript. |
| 6 | + |
| 7 | +## Vue Vuetify Renderers |
| 8 | + |
| 9 | +This is the JSON Forms Vue Vuetify renderers package which provides a Vuetify based renderer set for [JSON Forms Vue](https://github.com/eclipsesource/jsonforms/blob/master/packages/vue/vue). |
| 10 | +The renderers are in a preview state. |
| 11 | + |
| 12 | +### Quick start |
| 13 | + |
| 14 | +Install JSON Forms Core, Vue 3 and Vue 3 Vuetify Renderers. |
| 15 | + |
| 16 | +```bash |
| 17 | +npm i --save @jsonforms/core @jsonforms/vue @jsonforms/vue-vuetify |
| 18 | +``` |
| 19 | + |
| 20 | +Also add the packages to the transpile dependencies in the `vue.config.js` file: |
| 21 | + |
| 22 | +```js |
| 23 | +module.exports = { |
| 24 | + transpileDependencies: ['@jsonforms/core', '@jsonforms/vue', '@jsonforms/vue-vuetify'] |
| 25 | +} |
| 26 | +``` |
| 27 | + |
| 28 | +Use the `json-forms` component for each form you want to render and hand over the renderer set. |
| 29 | + |
| 30 | +```vue |
| 31 | +<script> |
| 32 | +import { JsonForms } from '@jsonforms/vue'; |
| 33 | +import { vuetifyRenderers } from '@jsonforms/vue-vuetify'; |
| 34 | +
|
| 35 | +const renderers = [ |
| 36 | + ...vuetifyRenderers, |
| 37 | + // here you can add custom renderers |
| 38 | +]; |
| 39 | +
|
| 40 | +export default defineComponent({ |
| 41 | + name: 'app', |
| 42 | + components: { |
| 43 | + JsonForms, |
| 44 | + }, |
| 45 | + data() { |
| 46 | + return { |
| 47 | + renderers: Object.freeze(renderers), |
| 48 | + data, |
| 49 | + schema, |
| 50 | + uischema, |
| 51 | + }; |
| 52 | + }, |
| 53 | + methods: { |
| 54 | + onChange(event) { |
| 55 | + this.data = event.data; |
| 56 | + }, |
| 57 | + }, |
| 58 | +}); |
| 59 | +</script> |
| 60 | +
|
| 61 | +<template> |
| 62 | + <json-forms |
| 63 | + :data="data" |
| 64 | + :schema="schema" |
| 65 | + :uischema="uischema" |
| 66 | + :renderers="renderers" |
| 67 | + @change="onChange" |
| 68 | + /> |
| 69 | +</template> |
| 70 | +
|
| 71 | +<style scoped> |
| 72 | +@import '~@jsonforms/vue-vuetify/lib/jsonforms-vue-vuetify.esm.css'; |
| 73 | +</style> |
| 74 | +``` |
| 75 | + |
| 76 | +If note done yet, please [install Vuetify for Vue](https://vuetifyjs.com/en/getting-started/installation/). |
| 77 | + |
| 78 | +For more information on how JSON Forms can be configured, please see the [README of `@jsonforms/vue`](https://github.com/eclipsesource/jsonforms/blob/master/packages/vue/vue/README.md). |
| 79 | + |
| 80 | +## License |
| 81 | + |
| 82 | +The JSONForms project is licensed under the MIT License. See the [LICENSE file](https://github.com/eclipsesource/jsonforms/blob/master/LICENSE) for more information. |
0 commit comments