index.vue
1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<template>
<vue-json-editor v-model="resultInfo" :showBtns="false" :mode="'code'" lang="zh" @json-change="onJsonChange"
@json-save="onJsonSave" />
</template>
<script>
// 引入json编译器
import vueJsonEditor from 'vue-json-editor'
export default {
components: {
vueJsonEditor
},
data () {
return {
myValue: this.value,
resultInfo: {
"userId": "1111111129ac7325-30da-4e6a-8a00-9699820fc04a",
"realName": "小雪18",
"gradeCode": "166",
"provinceCode": "110000",
"cityCode": {
"test1": "test1",
"test2": "test2"
},
"schoolId": 21,
"schoolLevel": 1,
"schoolName": "北京第二实验小学朝阳学校"
},
}
},
methods: {
onJsonChange (value) {
console.log('value:', value);
},
onJsonSave (value) {
console.log('value:', value);
}
}
}
</script>
<style>
/* jsoneditor右上角默认有一个链接,加css去掉了 */
.jsoneditor-poweredBy {
display: none;
}
.jsoneditor-vue {
height: 300px;
}
</style>