vue-json-tree

Vue component that renders JSON data in a collapsible tree structure.
141,887 50
Install
npm install vue-json-tree
Latest Version:0.4.3
Vue:2
License:MIT
Last Updated:Jan 6, 2023
Links: GitHub  ·  npm
Maintainer: myst729

vue-json-tree

CircleCI NPM License

Vue component that renders JSON data in a collapsible tree structure.

usage

use in browsers
  • Include the CSS and JS along with Vue, so you get a <json-tree> component.
<script src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
<script src="https://unpkg.com/vue-json-tree@0.4.1/dist/json-tree.js"></script>
  • Instantiate the component with your data.
<div id="app"></div>
<script>
  new Vue({
    template: '<json-tree :raw="sample"></json-tree>',
    el: '#app',
    data: {
      sample: '{"foo": "bar"}'
    }
  })
</script>
use with webpack and vue-loader
  • Install the vue-json-tree package via NPM.
npm install --save vue-json-tree
  • Import the SFC (with CSS embedded) and register it as a component, either globally or in another component.
import JsonTree from 'vue-json-tree'
Vue.component('json-tree', JsonTree)

props

raw (string, optional)

The data you want to present in the tree view. Must be a valid JSON string, otherwise it fails.

data (any, optional)

If your JSON data has already been parsed, bind this one instead. Must be something that can be produced by JSON.parse().

level (number, optional)

Sometimes the data structure is very deep. You could set them to collapsed on load. By default all levels are expanded.

demo

https://myst729.github.io/vue-json-tree/

MIT © Leo

Related Packages

json-tree-view-vue3

JSON tree rendering Vue3 component

110,063 39
@visual-json/vue

Vue 3 components for visual-json — the visual JSON editor. Schema-aware, embedda...

3,339
vue-json-component

A VueJS JSON Tree View with no dependencies and module builds.

81,535 84
vue-json-component-vue-3

A VueJS JSON Tree View with no dependencies and module builds.

11,601 2
vue-json-viewer

vuejs展示json的组件

2,352,644 579

Version History

Version Released License
0.4.3 MIT
0.4.2 MIT
0.4.1 MIT
0.4.0 MIT
0.3.5 MIT