🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

vue-json-pretty

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-json-pretty

A JSON tree view component that is easy to use and also supports data selection.

1.9.5
v1-latest
Source
npm
Version published
Weekly downloads
163K
-3.7%
Maintainers
1
Weekly downloads
 
Created
Source

Vue Json Pretty

A Vue component for rendering JSON data as a tree structure.

Use Vue2, see 1.x.

Use Vue3, see master.

Build Status npm package GitHub license Sizes NPM downloads Issues

English | 简体中文

Features

  • As a JSON Formatter.
  • Support get item data from JSON.
  • Support big data.
  • Support editable.

Environment Support

  • Modern browsers, Electron and Internet Explorer 11 (with polyfills)
  • Server-side Rendering
IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
Electron
Electron
IE11, Edgelast 10 versionslast 10 versionslast 10 versionslast 2 versions

Using NPM or Yarn

$ npm install vue-json-pretty@v1-latest --save
$ yarn add vue-json-pretty@v1-latest

Use Vue3

$ npm install vue-json-pretty --save

Usage

The CSS file is included separately and needs to be imported manually. You can either import CSS globally in your app (if supported by your framework) or directly from the component.

<template>
  <div>
    <vue-json-pretty :data="{ key: 'value' }" />
  </div>
</template>

<script>
import VueJsonPretty from 'vue-json-pretty';
import 'vue-json-pretty/lib/styles.css';

export default {
  components: {
    VueJsonPretty,
  },
};
</script>

Use Nuxt.js

  • In plugins/vue-json-pretty.js
import Vue from 'vue'
import VueJsonPretty from 'vue-json-pretty'

Vue.component("vue-json-pretty", VueJsonPretty)
  • In nuxt.config.js
css: [
  'vue-json-pretty/lib/styles.css'
],
plugins: [
  '@/plugins/vue-json-pretty'
],

Props

PropertyDescriptionTypeDefault
data(v-model)JSON data, support v-model when use editableJSON object-
collapsedNodeLengthObjects or arrays which length is greater than this threshold will be collapsednumber-
deepPaths greater than this depth will be collapsednumber-
showLengthShow the length when collapsedbooleanfalse
showLineShow the linebooleantrue
showLineNumberShow the line numberbooleanfalse
showIconShow the iconbooleanfalse
showDoubleQuotesShow doublequotes on keybooleantrue
virtualUse virtual scrollbooleanfalse
heightThe height of list when using virtualnumber400
itemHeightThe height of node when using virtualnumber20
selectedValue.syncSelected data pathstring, array-
rootPathRoot data pathstringroot
nodeSelectableDefines whether a data path supports selectionfunction(node)-
selectableTypeSupport path select, default nonemultiple, single-
showSelectControllerShow the select controllerbooleanfalse
selectOnClickNodeTrigger select when click nodebooleantrue
highlightSelectedNodeSupport highlighting selected nodesbooleantrue
collapsedOnClickBracketsSupport click brackets to collapsebooleantrue
editableSupport editablebooleanfalse
editableTriggerTriggerclick, dblclickclick

Events

Event NameDescriptionParameters
node-clicktriggers when click node(node: NodeData)
brackets-clicktriggers when click brackets(collapsed: boolean)
icon-clicktriggers when click icon(collapsed: boolean)
selected-changetriggers when the selected value changed(newVal, oldVal)

Slots

Slot NameDescriptionParameters
nodeKeyrender node key{ node, defaultKey }
nodeValuerender node value{ node, defaultValue }

Contributors

Keywords

vue

FAQs

Package last updated on 12 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts