@axolo/json-editor-vue
Vue 的一个简单的 JSON 编辑器 代码 第6版 (中文(简体) ).
安装
npm i @axolo/json-editor-vue
使用量
<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>
道具
| 名称 | 类型 | 默认 | 说明 |
modelValue | any | | JSON 字符串,对象,阵列... |
placeholder | String | | 占位符 |
readonly | Boolean | false | 只读 |
dark | Boolean | false | 暗色主题为 oneDark |
codec | [Boolean, Array] | false | 见 代码c |
format | [Boolean, Function] | false | 见 格式 (台词) |
extensions | Array | [] | 额外的代码解码器扩展 (TODO) |
代码c
| 数值 | 说明 |
false | 默认,什么都不做, modelValue 是 JSON 字符串 |
true | [JSON.stringify, JSON.parse], (中文(简体) ), modelValue 这不是 JSON 字符串 |
Array | 自定义编码器、 [编码、 解码] 阵列( TODO) |
| 数值 | 说明 |
false | 默认, 不做任何事情 |
true | JSON.stringify(json, null, 2) |
Function | 自定义事项 |
输出
| 名称 | 参数 | 说明 |
update:modelValue | 乔森 | 更新模式 |
change | 乔森 | 模型数值 |
error | 错误 | 扔出错误或 false 当模糊 |
方远明
2023-12-09 (中文(简体) )