0.8.0 • Published 3 years ago

v-json-edit v0.8.0

Weekly downloads
18
License
MIT
Repository
github
Last release
3 years ago

v-json-edit

Install

$ npm install --save v-json-edit
# or
$ yarn add v-json-edit

Usage

import Vue from 'vue'
import vJsonEdit from 'v-json-edit'
Vue.use(vJsonEdit)
<!--开启编辑,拖拽,监听改变, 将on-change修改为change防止与系统冲突-->
<v-json-edit v-model="json" edit drag @change="changeHandle"></v-json-edit>
export default {
  data () {
    return {
       json: {} // 渲染值
    }
  },
  methods: {
    changeHandle (val) {
      // 改变值
    }
  }
}

API

Attributes

参数说明类型默认值可选值
v-model渲染值String/Object/Array/Number--
mode默认编辑器模式stringtree-
modes编辑器模式array"tree", "code", "form", "text", "view", "preview"-
search右侧是否展示搜索booleanfalse-
lang显示语言stringenen, pt-BR, zh-CN, tr, ja, fr-FR
drag是否可拖拽booleanfalse-
edit是否可编辑booleanfalse-
expand展开所有数据booleantrue-
history启用历史记录操作按钮booleantrue-
mainMenuBar是否显示主功能栏booleantrue-
navigationBar显示树结构上当前位置,适用于: tree/form/view模式booleanfalse-

Events

事件名称说明回调参数
change当值进行改变时触发value
on-mode当模式切换时触发{newMode, oldMode}
on-error错误时触发error
on-select-text当选中数据时触发(仅适用于mode: code, 'text'){start, end, text}
0.8.0

3 years ago

0.7.0

3 years ago

0.6.0

3 years ago

0.5.0

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago