Code Monkey home page Code Monkey logo

vue2-jsoneditor's Introduction

Vue2 json editor Wrapper

Usage

Importing:

import JSONEditor from 'vue2-jsoneditor'

export default {
    name: 'app',
    data () {
        return {
            json: {
                foo: 'bar'
            }
        }
    }
    methods: {
         onChange(newJson) {
            // handle json changes
         }
    }
    components: {
        JSONEditor
    }
}

Then you can use it like this in your template: Note: onChange handler is optional

<template>
    <json-editor :onChange="onChange" :json="json" />
</template>

You can also put a ref on the editor to access the JsonEditor object directly:

<template>
    <json-editor ref="editor" />
</template>

if you need, you can access the editor instance like this:

const editor = this.$refs.editor.editor // a little redundant, but it does the trick!
editor.set(...) // At this point, you can use the methods available here: https://github.com/josdejong/jsoneditor/blob/master/docs/api.md#methods

Build Setup

Vue.js 2 Webpack template was used to generate this project.

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

For detailed explanation on how things work, checkout the guide and docs for vue-loader.

vue2-jsoneditor's People

Contributors

adam-jimenez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vue2-jsoneditor's Issues

Json render issue

Hi!

Thank you for this wrapper :).

I'm including it in a project but when it's rendered like this:
captura de pantalla 2018-03-01 a las 9 14 26

I've imported the editor inside a component in my component, also included in my components section and added json object to data method.

What i'm missing?

Thanks in advance :).

Upgrade to newest version of jsoneditor?

Hi, the library is great.

Is it possible to upgrade the jsoneditor dependency to the newest version and publish it to the npm, so we can use the newest features as colorpickers, ...?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.