0.0.5 • Published 1 year ago

vue-json-pretty-editor v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Build Status npm package GitHub license Sizes NPM downloads Issues

npm.io

English | 简体中文 export NODE_OPTIONS=--openssl-legacy-provider

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 / EdgeFirefoxChromeSafariElectron
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

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

Vue.component("vue-json-pretty", VueJsonPretty)
  1. 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-
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

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago