0.4.0 • Published 3 years ago

@kassaila/vue-json-editor v0.4.0

Weekly downloads
12
License
Apache-2.0
Repository
github
Last release
3 years ago

vue-json-editor

JSON visual editor - built as a Vue.js component. Provides a basic GUI

Please preview - demo example

Install

Install package from npm:

npm i @kassaila/vue-json-editor

Usage

Single file component

<template>
  <json-editor :data-input="dataInput" @data-output="(data) => (dataOutput = data)"> </json-editor>
</template>
<script>
  import JsonEditor from '@kassaila/vue-json-editor';

  export default {
      ...
      components: {
        JsonEditor,
      },
      data() {
          return {
              dataInput: {
                name: 'Taras',
                age: 28,
                address: [
                  'Ukraine',
                  {
                    city: 'Kharkiv',
                  },
                ],
                others: {
                  id: 1246,
                  time: new Date(),
                  description: 'last example run',
                  pattern: /abc/g,
                },
              },
              dataOutput: {},
          };
      },
  }
</script>

Capability

NameOptionsTypeRequiredDescription
data-inputpropsObject, Array, String, Number, Boolean, Null, Date, RegExp, FunctiontrueInput data
optionspropsObjectfalseReserved (now empty)
data-outputeventObject, Array, String, Number, Boolean, Null-Output data, return modified data
icon-addslot<template>falseIcon for button - add new item
icon-deleteslot<template>falseIcon for button - delete item
icon-dragslot<template>falseIcon for dragbar
icon-collapseslot<template>falseIcon for button - collapse object list

For some types of the data, like Date, RegExp, Function will be applied transformation to string (by the method .toString())

This is a modified version of the fork vue-json-edit

0.4.0

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago