[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![David deps][david-image]][david-url]
[![npm download][download-image]][download-url]
[![npm license][license-image]][download-url]
[npm-image]: https://img.shields.io/npm/v/vue-json-ui-editor.svg?style=flat-square
[npm-url]: https://npmjs.org/package/vue-json-ui-editor
[travis-image]: https://img.shields.io/travis/yourtion/vue-json-ui-editor.svg?style=flat-square
[travis-url]: https://travis-ci.org/yourtion/vue-json-ui-editor
[coveralls-image]: https://img.shields.io/coveralls/yourtion/vue-json-ui-editor.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/yourtion/vue-json-ui-editor?branch=master
[david-image]: https://img.shields.io/david/yourtion/vue-json-ui-editor.svg?style=flat-square
[david-url]: https://david-dm.org/yourtion/vue-json-ui-editor
[download-image]: https://img.shields.io/npm/dm/vue-json-ui-editor.svg?style=flat-square
[download-url]: https://npmjs.org/package/vue-json-ui-editor
[license-image]: https://img.shields.io/npm/l/vue-json-ui-editor.svg
# json-editor
[![Greenkeeper badge](https://badges.greenkeeper.io/yourtion/vue-json-ui-editor.svg)](https://greenkeeper.io/)
[![DeepScan grade](https://deepscan.io/api/teams/2046/projects/2774/branches/19927/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=2046&pid=2774&bid=19927)
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 'vue-json-ui-editor';
export default {
components: { JsonEditor },
data: () => ({
// init json schma file ( require('@/schema/newsletter') )
schema: SCHEMA,
// data
model: {
name: 'Yourtion',
},
}),
methods: {
submit(_e) {
alert(JSON.stringify(this.model));
},
reset() {
this.$refs.JsonEditor.reset();
},
},
};
</script>
```
More info on: [Example-Subscription](example/components/Subscription.vue)
Schema: [newsletter.json](example/schema/newsletter.json)
## props
- `schema` ***Object*** (*required*)
The JSON Schema object. Use the `v-if` directive to load asynchronous schema.
- `v-model` ***Object*** (*optional*) `default: [object Object]`
Use this directive to create two-way data bindings with the component. It automatically picks the correct way to update the element based on the input type.
- `auto-complete` ***String*** (*optional*)
This property indicates whether the value of the control can be automatically completed by the browser. Possible values are: `off` and `on`.
- `no-validate` ***Boolean*** (*optional*)
This Boolean attribute indicates that the form is not to be validated when submitted.
- `input-wrapping-class` ***String*** (*optional*)
Define the inputs wrapping class. Leave `undefined` to disable input wrapping.
## data
- `default`
*initial value:* `[object Object]`
- `fields`
*initial value:* `[object Object]`
- `error`
*initial value:* `null`
- `data`
*initial value:* `[object Object]`
## events
- `input` Fired synchronously when the value of an element is changed.
- `change` Fired when a change to the element's value is committed by the user.
- `invalid` Fired when a submittable element has been checked and doesn't satisfy its constraints. The validity of submittable elements is checked before submitting their owner form, or after the `checkValidity()` of the element or its owner form is called.
- `submit` Fired when a form is submitted
## methods
- `input(name)`
Get a form input reference
- `form()`
Get the form reference
- `checkValidity()`
Checks whether the form has any constraints and whether it satisfies them. If the form fails its constraints, the browser fires a cancelable `invalid` event at the element, and then returns false.
- `reset()`
Reset the value of all elements of the parent form.
- `submit(event)`
Send the content of the form to the server
- `setErrorMessage(message)`
Set a message error.
- `clearErrorMessage()`
clear the message error.
没有合适的资源?快使用搜索试试~ 我知道了~
vue-json-ui-editor.zip
共59个文件
js:27个
json:5个
map:4个
需积分: 50 8 下载量 191 浏览量
2020-04-04
13:08:39
上传
评论
收藏 1.29MB ZIP 举报
温馨提示
基于Vue的JSON可视化编辑器,通过定义 JSON Schema 直接生成 UI 界面 挺好的,https://jsonui.js.org/
资源推荐
资源详情
资源评论
收起资源包目录
vue-json-ui-editor.zip (59个子文件)
vue-json-ui-editor
.travis.yml 114B
example
App.vue 437B
schema
newsletter.json 3KB
main.js 494B
components
Subscription.vue 5KB
.babelrc 234B
config
index.js 3KB
prod.env.js 62B
dev.env.js 156B
docs
CNAME 13B
index.html 520B
static
css
app.f60de8a36547efcbcfffde85c7c98845.css 180KB
app.f60de8a36547efcbcfffde85c7c98845.css.map 261KB
fonts
element-icons.6f0a763.ttf 11KB
js
app.6929d2b6ad0b23e9ecf4.js.map 97KB
manifest.2ae2e69a05c33dfc65f8.js 857B
app.6929d2b6ad0b23e9ecf4.js 15KB
vendor.520118608f94f59d02d1.js.map 4.26MB
manifest.2ae2e69a05c33dfc65f8.js.map 9KB
vendor.520118608f94f59d02d1.js 690KB
package.json 3KB
test
simple.test.js 2KB
data
complex.json 3KB
simple.json 914B
signup.json 1018B
schema.test.js 2KB
.eslintrc.js 123B
jest.conf.js 506B
__snapshots__
schema.test.js.snap 1KB
simple.test.js.snap 2KB
complex.test.js.snap 6KB
complex.test.js 713B
component.test.js 2KB
index.html 280B
LICENSE 1KB
.DS_Store 6KB
static
.gitkeep 0B
src
utils.js 2KB
JsonEditor.vue 13KB
parser.js 5KB
.eslintrc.js 120B
.coveralls.yml 47B
.gitignore 181B
lib
json-editor.min.js 61KB
readme
README.md 4KB
.prettierrc.js 104B
.eslintignore 30B
.editorconfig 147B
screenshot.jpg 68KB
build
utils.js 3KB
webpack.dist.conf.js 2KB
build.js 1KB
webpack.prod.conf.js 5KB
check-versions.js 1KB
webpack.dev.conf.js 2KB
logo.png 7KB
webpack.base.conf.js 2KB
vue-loader.conf.js 543B
.postcssrc.js 223B
共 59 条
- 1
资源评论
jacky68147527
- 粉丝: 12
- 资源: 69
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功