vue-json-viewer 组件,简单易用的json内容展示组件,可以伸缩
https://www.npmjs.com/package/vue-json-viewer
https://github.com/chenfengjw163/vue-json-viewer/blob/master/README_CN.md
使用 npm:
$ npm install vue-json-viewer --save
使用 yarn:
$ yarn add vue-json-viewer
使用:
<template>
<json-viewer :value="jsonData"/>
</template>
<script>
import JsonViewer from 'vue-json-viewer'
export default {
name: "jsons",
components: {
JsonViewer
},
data() {
return {
jsonData: {"id": 2, "userid": "3", "result": [{'id': 1, "h": 4}]},
}
}
}
</script>
<style scoped>
</style>
附送: 判断字符是否为json https://blog.csdn.net/zhanghe_zht/article/details/103460533
原文链接:https://blog.csdn.net/zhanghe_zht/article/details/103463590
另外一个,这个是直接展示开来的 (文本那样)不可伸缩
https://blog.csdn.net/MtangEr/article/details/123402257