Skip to content

Commit ea8f0cd

Browse files
authored
Merge pull request #40 from leezng/dev
release 1.6.1
2 parents 208790e + 2c6cd04 commit ea8f0cd

File tree

5 files changed

+2262
-1321
lines changed

5 files changed

+2262
-1321
lines changed

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
A vue 2.x component for rendering JSON data as a tree structure.
88

9-
- basic: JSON pretty
10-
- advanced: get item data from JSON
9+
- As a JSON Formatter
10+
- Get item data from JSON
1111

1212
## Links
1313

@@ -49,25 +49,25 @@ export default {
4949

5050
## Props
5151

52-
- If you are using only the basic features (JSON pretty), just focus on the `base` properties.
53-
- If you are using advanced features (selected), you can use `base` and `advanced` attributes.
52+
- If you are using only the normal features (JSON pretty), just focus on the `base` properties.
53+
- If you are using higher features (Get data), you can use `base` and `higher` attributes.
5454

5555
| Attribute | Level | Description | Type | Default |
5656
|-------- |-------- |-------- |-------- | -------- |
57-
| data | basic | json data | JSON object | - |
58-
| deep | basic | data depth, data larger than this depth will not be expanded | number | Infinity |
59-
| showLength | basic | whether to show the length when closed | boolean | false |
60-
| showLine | basic | whether to show the line | boolean | true |
61-
| showDoubleQuotes | basic | whether to show doublequotes on key | boolean | true |
62-
| highlightMouseoverNode | basic | highlight current node when mouseover | boolean | false |
63-
| v-model | advanced | defines value when the tree can be selected | string, array | -, [] |
64-
| path | advanced | root data path | string | root |
65-
| pathChecked | advanced | defines the selected data path | array | [] |
66-
| pathSelectable | advanced | defines whether a data path supports selection | Function(itemPath, itemData) | - |
67-
| selectableType | advanced | defines the selected type, this feature is not supported by default | enum: -, multiple, single | - |
68-
| showSelectController | advanced | whether to show the select controller at left | boolean | false |
69-
| selectOnClickNode | advanced | whether to change selected value when click node | boolean | true |
70-
| highlightSelectedNode | advanced | highlight current node when selected | boolean | true |
57+
| data | normal | json data | JSON object | - |
58+
| deep | normal | data depth, data larger than this depth will not be expanded | number | Infinity |
59+
| showLength | normal | whether to show the length when closed | boolean | false |
60+
| showLine | normal | whether to show the line | boolean | true |
61+
| showDoubleQuotes | normal | whether to show doublequotes on key | boolean | true |
62+
| highlightMouseoverNode | normal | highlight current node when mouseover | boolean | false |
63+
| v-model | higher | defines value when the tree can be selected | string, array | -, [] |
64+
| path | higher | root data path | string | root |
65+
| pathChecked | higher | defines the selected data path | array | [] |
66+
| pathSelectable | higher | defines whether a data path supports selection | Function(itemPath, itemData) | - |
67+
| selectableType | higher | defines the selected type, this feature is not supported by default | enum: -, multiple, single | - |
68+
| showSelectController | higher | whether to show the select controller at left | boolean | false |
69+
| selectOnClickNode | higher | whether to change selected value when click node | boolean | true |
70+
| highlightSelectedNode | higher | highlight current node when selected | boolean | true |
7171

7272
## Events
7373

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-json-pretty",
3-
"version": "1.6.0",
4-
"description": "A Vue.js 2.0 Toolkit for JSON",
3+
"version": "1.6.1",
4+
"description": "A JSON tree view component that is easy to use and also supports data selection.",
55
"author": "leezng <im.leezng@gmail.com>",
66
"main": "vue-json-pretty.js",
77
"scripts": {
@@ -44,7 +44,7 @@
4444
"cross-spawn": "^5.0.1",
4545
"css-loader": "^0.28.0",
4646
"cssnano": "^3.10.0",
47-
"eslint": "^3.19.0",
47+
"eslint": "^4.18.2",
4848
"eslint-config-standard": "^6.2.1",
4949
"eslint-friendly-formatter": "^3.0.0",
5050
"eslint-loader": "^1.7.1",
@@ -74,7 +74,7 @@
7474
"vue-style-loader": "^3.0.1",
7575
"vue-template-compiler": "^2.5.0",
7676
"webpack": "^3.12.0",
77-
"webpack-bundle-analyzer": "^2.2.1",
77+
"webpack-bundle-analyzer": "^3.3.2",
7878
"webpack-dev-middleware": "^1.10.0",
7979
"webpack-hot-middleware": "^2.18.0",
8080
"webpack-merge": "^4.1.0"

src/components/app.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
'is-highlight-selected': isSelected && highlightSelectedNode,
1010
'is-mouseover': isMouseover
1111
}"
12-
@click.stop="handleClick($event, 'tree')"
12+
@click="handleClick($event, 'tree')"
1313
@mouseover.stop="handleMouseover"
1414
@mouseout.stop="handleMouseout">
1515
<template v-if="showSelectController && selectable">
@@ -239,9 +239,14 @@
239239
methods: {
240240
/**
241241
* emit click event
242-
* @param {Boolean} emitType tree/checkbox/radio
242+
* @param {string} emitType tree/checkbox/radio
243243
*/
244244
handleClick (e, emitType = '') {
245+
// Event can not be stopPropagation, because user may be listening the click event.
246+
// So use _uid to simulated.
247+
if (e._uid && e._uid !== this._uid) return
248+
e._uid = this._uid
249+
245250
this.$emit('click', this.path, this.data)
246251
if (!this.selectable) return
247252

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import App from './components/app.vue'
22
import './assets/less/index.less'
33

44
export default Object.assign({}, App, {
5-
version: '1.6.0'
5+
version: '1.6.1'
66
})

0 commit comments

Comments
 (0)