0.3.2 • Published 2 months ago

@axolo/json-editor-vue v0.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

@axolo/json-editor-vue

A simple JSON editor of Vue based on CodeMirror Version 6.

Install

npm i @axolo/json-editor-vue

Usage

<script>
import JsonEditor from '@axolo/json-editor-vue'

export default {
  components: {
    JsonEditor
  },
  data() {
    return {
      json: {
        required: true,
        message: 'please input content'
      }
    }
  }
}
</script>

<template>
  <json-editor
    v-model="json"
    codec
    dark
    placeholder="please input json"
    @change="console.log"
    @error="console.error"
  />
</template>

Props

NameTypeDefaultDescription
modelValueanyJSON string, object, array ...
placeholderStringplaceholder
readonlyBooleanfalsereadonly
darkBooleanfalsedark theme as oneDark
codec[Boolean, Array]falseSee codec
format[Boolean, Function]falseSee format (TODO)
extensionsArray[]extra codemirror extensions (TODO)

codec

ValueDescription
falsedefault, do nothing, modelValue is JSON string
true[JSON.stringify, JSON.parse], modelValue is not JSON string
Arraycustom codec, Aarray of encode, decode

format

ValueDescription
falsedefault, do nothing
trueJSON.stringify(json, null, 2)
Functioncustom formatter

Emits

NameParametersDescription
update:modelValuejsonupdate modelValue
changejsonvalue of modelValue
errorerrorthrow error or false when blur

Yueming Fang 2023-12-09

0.3.2

2 months ago

0.3.0

3 months ago

0.3.1

3 months ago

0.2.3

5 months ago

0.2.2

5 months ago

0.2.1

5 months ago

0.2.0

5 months ago

0.1.0

5 months ago