Skip to content

Commit

Permalink
📝 update README add screenshot and sample
Browse files Browse the repository at this point in the history
  • Loading branch information
yourtion committed May 18, 2018
1 parent 9ba3c1d commit 3f091f8
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,62 @@

Edit JSON in UI form with JSON Schema and Vue.js `<json-editor>` component.

![ScreenShot](screenshot.jpg)

## Install

```bash
npm install vue-json-ui-editor --save
```

## Use

```Vue
<template>
<json-editor ref="JsonEditor" :schema="schema" v-model="model">
<button @click="submit">submit</button>
<button @click="reset">Reset</button>
</json-editor>
</template>
<script>
const SCHEMA = {
type: 'object',
title: 'vue-json-editor demo',
properties: {
name: {
type: 'string',
},
email: {
type: 'string',
},
},
};
// import vue-json-ui-editor
import JsonEditor from '../../src/JsonEditor.vue';
export default {
components: { JsonEditor },
data: () => ({
// init json schma file
schema: SCHEMA,
// data
model: {
name: 'Yourtion',
},
}),
methods: {
submit(_e) {
alert(JSON.stringify(this.model));
},
reset() {
this.$refs.JsonEditor.reset();
},
},
};
</script>
```

## props

- `schema` ***Object*** (*required*)
Expand Down
Binary file added screenshot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3f091f8

Please sign in to comment.