Giter Club home page Giter Club logo

vue-json-editor's Introduction

vue-json-editor

A json editor of vue.js

Component properties

v-model:bind the [json object] :show-btns: boolean, show the save button, default: true :expandedOnStart: boolean, expand the JSON editor on start for the modes 'tree', 'view', and 'form', default: false :mode: string, default: tree :lang: string, default: en @json-change: on json changed @json-save: on json save @has-error: on error

How to use

1. Install using npm

npm install vue-json-editor --save

2. Use vue-json-editor in the vue component

<template>
  <div>
    <p>vue-json-editor</p>
    <vue-json-editor v-model="json" :show-btns="true" :expandedOnStart="true" @json-change="onJsonChange"></vue-json-editor>
  </div>
</template>

<script>
  import vueJsonEditor from 'vue-json-editor'

  export default {
    data () {
      return {
        json: {
          msg: 'demo of jsoneditor'
        }
      }
    },

    components: {
      vueJsonEditor
    },

    methods: {
      onJsonChange (value) {
        console.log('value:', value)
      }
    }
  }
</script>

vue-json-editor's People

Contributors

alexmgillis avatar bnyu avatar corentin-allemand avatar danieljosephbrennan avatar dflock avatar dirkliu avatar gyejoon avatar jpbecotte avatar kotskinkotskin avatar tianzhihen avatar tuttarealstep 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

vue-json-editor's Issues

Collission with tailwind `spin` class => please update `json-editor` dependency

Currently, when using vue-json-editor together with tailwind < 2, the tailwind spin animation is replaced by the spin animation from vue-json-editor, or to be more specific, from the animation defined by the json-editor dependency. I already renamed the spin animation in json-editor and a new version 9.4.0 has been released with the fix. Could you consume this version to avoid the collissions?

Here's the (already merged) PR:
josdejong/jsoneditor#1333

And the fix has been published in this version:
https://github.com/josdejong/jsoneditor/releases/tag/v9.4.2

Can't edit items in safari

Unable to change the value of items in safari. Works in chrome but text cursor doesn't appear in safari

Validation/error events from the embedded ace editor?

Thank You for this component, it's very helpful!

The built-in ace editor does syntax validation of JSON:

image

It would be great if these could be raised as events from the vue-json-editor component. That way, I could attach event handlers, maybe disable saving, etc...

Reload data inside component when data are changed from exterior

I'm using this tool to view and edit data in my vuejs pages. Especially I test a form that is describe by a JSON object and there is nested properties that represent fields. I realized that the object in the component was not modified by exterior fields on nested properties.

In component's code, there is a watcher that watch the input value only on root properties.

/* vue-json-editor.vue */
 watch: {
      value: function (newValue) {
        if (!this.internalChange) {
          this.editor.set(newValue)
        }
      }
    }

I think it's necessary to watch the whole object with this nested properties.

The showBtns attribute in Vue 2.5.13 (关于showBtns的设置)

In Vue 2.5.13 (在Vue 2.5.13 中使用时):

<vue-json-editor v-model="json" :showBtns="false"></vue-json-editor>

Vue tip: Prop "showbtns" is passed to component and button is always show.(当使用驼峰写法的时候,showBtns 无效)

The right way:(使用-的时候是有效的)

<vue-json-editor v-model="json" :show-btns="false"></vue-json-editor>

How to change default mode as "Code" mode in VueJS

I've installed npm package in my vue app.
My Code:

<vue-json-editor v-model="$store.state.content" :showBtns="false" @json-change="onJsonChange"></vue-json-editor>

<script>
  import vueJsonEditor from 'vue-json-editor'
  export default {
    name:'json-viewer',
    data: () => ({
        json : {}
    }),
    components: {
      vueJsonEditor
    },
    methods: {
      onJsonChange (value) {
          this.$store.state.content = value
      }
    }
  }
</script>

vue3.0中v-model绑定数据失效

`在vue3.0中v-model绑定数据失效,通过:value直接绑定却可以。
template>

vue-json-editor

改成 template>

vue-json-editor

`

Bug

I am making an extractor. When I successfully extract the json content, the result will be passed to the editor on the right. When the editor on the right is in text mode, an error will be reported. When it is in other modes, no error will be reported.
text
tree

online: http://8.134.174.223:3000/tools/jsonpath

vite run dev error

The browser throws

vue-json-editor.vue:17

   Uncaught (in promise) SyntaxError: The requested module '/node_modules/vue-json-editor/assets/jsoneditor.js' does not provide an export named 'default'

Error with vue3

I'm trying to use this great editor with vue3 in my project, using the simplest example from here.

It come out with error:
vue-json-editor.vue:17 Uncaught SyntaxError: The requested module '/node_modules/vue-json-editor/assets/jsoneditor.js' does not provide an export named 'default'

Can I use this editor in vue3? Then how?

vite build error

'pushScopeId' is not exported by node_modules/vue-json-editor/node_modules/vue/dist/vue.runtime.esm.js, imported by node_modules/vue-json-editor/vue-json-editor.vue

lang mode modes 不设置的话vue会报不能修改的错误

error:
vue.esm.js?a026:591 [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "modes"
原因是:源码中当不传入lang mode modes时会走:
if (this.mode === undefined) this.mode = defaultMode;
if (this.modes === undefined) this.modes = defaultModes;
if (this.lang === undefined) this.lang = 'en';这个逻辑
这样会修改prop从而报错,
建议默认值采用 lang {
type: String,
default: 'en'
},这种方式设定默认值,从而避免报错

How to enter Chinese in 'code' mode?

When you enter Chinese in 'Code' mode, there will be a shadow and you can't type it, only the letters will appear. The next time you type it, there will be a double shadow and it will carry the Chinese that should have appeared last time

Prop to collapse all fields

I've started employing your JSON editor for a form page at my work (Super helpful btw!) that is already packed with inputs. Is there any way you can add a prop to automatically collapse all fields by default? I had expected expandedOnStart="false" to do this for me, but that doesn't seem to be the case...

光标偏移啊

举例子:
| :代表光标
正常情况下,鼠标点击末尾,是这样的
00000|
现在
000|00
本来在最后一位,到了第四位,光标偏移了

Report error

VM105:13403 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-5L/i20KYvcBJFMYOVraZ3Ax915V4wGVT7oZhOeIT4gk='), or a nonce ('nonce-...') is required to enable inline execution.

显示问题

当vue-json-editor在tab组件中的第二个tab时(tab默认显示第一个),在第一个tab里面改变vue-json-editor绑定变量的值时,点击第二个tab,这个vue-json-editor显示的内容不会刷新,需要点击里面的内容才会刷新数据

missing css style

image
i try to use it in my vuecomponent but i find that i missed some of css style ,is that i have to import something else?

如何设置组件高度为100%?

我尝试将 style="height: 100%", 但是好像没有作用?在开发者控制台调试,需要同时将.jsoneditor-vue这个样式的控件高度调成100%才行,我的代码如下:

<vue-json-editor v-model="json" mode="code" :showBtns="false" @json-change="onJsonChange" style="height: 100%">

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.