安装
npm i bin-code-editor -S
// Vue2
npm install vue-json-viewer --save
在main.js引用
//引入bin-code-editor相关插件和样式
import CodeEditor from 'bin-code-editor';
import 'bin-code-editor/lib/styles/index.css';
import JsonViewer from 'vue-json-viewer'
//vue使用这个插件
Vue.use(CodeEditor);
Vue.use(JsonViewer)
theme: 'dark',
showNumber: true,
lint: true,
readonly: false,
wrap: true,
theme: 'idea',
jsonformat:{
expandDepth:5,
copyable:true
},
resultInfo:'',
<b-code-editor v-model="dynamicValidateForm.chartContent" :theme="theme"
:auto-format="false" ref="editor" :show-number="showNumber"
:readonly="readonly" :lint="lint"/>
<json-viewer
v-model="hisresult"
class="jsonview"
:expand-depth="jsonformat.expandDepth"
>
</json-viewer>