当项目需要再网页中展示原始的json数据的时候,我们期望能够对json进行格式化展示,并且能够进行展开和折叠。vue-json-viewer可以帮助我们实现这样的功能。1. 安装$ npm install vue-json-viewer@2 --save // Vue2 $ npm install vue-json-viewer@3 --save // Vue3 2. 配置在mai
Theming Installing Using npm: $ npm install vue-json-viewer@2 --save // Vue2 $ npm install vue-json-viewer@3 --save // Vue3 Using yarn: $ yarn add vue-json-viewer@2 // Vue2 $ yarn add vue-json-viewer@3 // Vue3 Example ...
// Vue2 yarn add vue-json-viewer@2 // Vue3 yarn add vue-json-viewer@3 2.引入并全局注册 在main.js(入口文件里面) 1. import JsonViewer from 'vue-json-viewer' 2. Vue.use(JsonViewer) 3.组件内使用 jsonData就是你想要渲染的数据 <json-viewer :value="jsonData"></json-viewer> 假数据...
Simple JSON viewer component, for Vue.js 2. Support for incremental update components Installing Example Options Theming Installing Using npm: $ npm install vue-json-viewer --save Using yarn: $ yarn add vue-json-viewer Example <json-viewer:value="jsonData"></json-viewer><json-viewer:value="...
###npm ``` $ npm install vue-json-viewer@2 --save // Vue2 $ npm install vue-json-viewer@3 --save // Vue3 ``` ###例子 ``` import JsonViewer from 'v
在Vue项目中使用vue-json-viewer进行JSON格式化,可以按照以下步骤进行: 安装vue-json-viewer 使用npm或yarn来安装vue-json-viewer。根据你的Vue版本(Vue 2或Vue 3),选择合适的版本进行安装。 bash # 对于Vue 3 npm install vue-json-viewer@3 --save # 或者 yarn add vue-json-viewer@3 # 对于Vue 2 npm...
Install & Download: # Vue 2 $ npm i vue-json-viewer@2 # Vue 3 $ npm i vue-json-viewer@3 Description: A simple and user-friendly JSON viewer for Vue 3 and Vue 2. Supports server side rendering. How to use it: 1. Import and register the JSON viewer. ...
&.jv-undefined { color:#e08331} &.jv-string { color:#42b983;word-break: break-word;white-space: normal; } }.jv-code{.jv-toggle{ &:before{padding:0px2px;border-radius:2px; } &:hover{ &:before{background:#eee; } } } } }...
1 2 3 4 但是通过JSON.stringify()处理后的内容直接用json-viewer,发现是一堆类似JSON格式的文本,依旧实现不了控制台那样的点击展开或关闭的情况,后面发现还要通过JSON.parse()进一步处理,将其处理成JavaScript对象。 所以接口内容处理代码如下: axios.get(this.urlAdd).then(res => { console.log(res); this....
Pull requests Actions Projects Security Insights Additional navigation options master 2Branches Tags Code Folders and files Name Last commit message Last commit date Latest commit qishibo add js file May 29, 2020 3065ea8·May 29, 2020 History ...