Giter VIP home page Giter VIP logo

vue-json-tree's Introduction

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.
<link href="https://unpkg.com/[email protected]/dist/json-tree.css" rel="stylesheet">
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<script src="https://unpkg.com/[email protected]/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

development

Want to fix bugs or implement new features?

# Grab the source code from GitHub
git clone [email protected]:myst729/vue-json-tree.git

# Install dependencies via NPM
npm install

# Run in dev mode and start to hack
npm run dev

# Make sure you run the tests
npm run test

# Build the dist files
npm run dist

MIT © Leo Deng

vue-json-tree's People

Contributors

myst729 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.