Skip to content
官方QQ交流群
pc端ui:468705115   点此加入
移动端ui:468217742   点此加入
技术交流1:87208295   点此加入
技术交流2:787747122   点此加入
官网
云控制台
开放平台
关注微信公众号
代码仓库: 码云

cv-editor-json json编辑器

简要

编辑 JSON 对象或者数组
Vue JSONEditor

  • json 编辑器
  • jsoneditor
  • vue-jsoneditor
  • vue3-jsoneditor
  • element-jsoneditor

示例

::: demo

vue
<template>
  <div>
    <h1>cv-editor-json 演示</h1>
    <div style="max-width: 1250px; margin: 20px auto">
      <cv-form-base ref="refFormBase" :rules="formRules" :model="formData">
        <cv-form-item label="系统配置1">
          <cvEditorJson v-model="formData.jsonValue" @handleRequest="handleRequest" style="height: 300px; width: 500px" />
        </cv-form-item>
        <cv-form-item label="系统配置2">
          <cvEditorJson v-model="formData.jsonValue" readOnly />
        </cv-form-item>
      </cv-form-base>
      <!-- <JsonEditorVue  class="editor" v-model="data" @blur="validate" /> -->
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      formRules: {},
      formData: {
        jsonValue: { hello: 'vue' }
      }
    };
  },
  watch: {
    'formData.jsonValue'(newVal) {
      console.log('---newVal---', newVal);
    }
  },
  methods: {
    handleRequest(data) {
      console.log(data);
    },
    handleSuccess() {
      console.log('提交成功');
    }
  },
  mounted() {}
};
</script>

:::

demo

属性

属性名描述类型可选值默认值
v-model/modelValueObject valueObject-
optionsJsoneditor params, You can look at the detailedObject-{ mode: 'code' }
plusWhether full screen switching is addedBoolean-true
heightDefault heightString-
mode模式Stringtext / tree / tabletext
readOnly是否只读

更多参数,相见 https://github.com/josdejong/svelte-jsoneditor#properties

事件

事件名说明参数
errorError callback

相关链接

两个都是同一个作者

Copyright © 2017 10yun.com | 十云提供计算服务-IPV6 | ctocode组开发