File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " vue-json-pretty" ,
3
- "version" : " 1.1.0 " ,
3
+ "version" : " 1.1.1 " ,
4
4
"description" : " A Vue.js project" ,
5
5
"author" :
" leezng <[email protected] >" ,
6
6
"main" : " vue-json-pretty.js" ,
Original file line number Diff line number Diff line change 5
5
:data =" data"
6
6
:index =" index"
7
7
:last-index =" lastIndex" >
8
- <span v-if =" child && Array.isArray(data )" >{{ index }}:</span >
8
+ <span v-if =" child && ! Array.isArray(json )" >{{ index }}:</span >
9
9
</brackets-left >
10
10
11
11
<!-- data 为对象时, index 表示 key, 为数组才表示索引 -->
20
20
@click.stop =" handleClick" >
21
21
<tree
22
22
v-if =" Array.isArray(item) || isObject(item)"
23
+ :json =" data"
23
24
:data =" item"
24
25
:path =" path + (Array.isArray(data) ? `[${index}]` : `.${index}`)"
25
26
:index =" index"
50
51
export default {
51
52
name: ' tree' ,
52
53
props: {
53
- data: {},
54
- child: Boolean ,
54
+ /* 外部可用 START */
55
+ data: {}, // 当前树的数据
56
+ // 数据层级顶级路径
55
57
path: {
56
58
type: String ,
57
59
default: ' root'
58
60
},
61
+ /* 外部可用 END */
62
+ json: {}, // 当前树的父级数据
63
+ child: Boolean , // 是否子树
59
64
index: {},
60
65
lastIndex: {}
61
66
},
Original file line number Diff line number Diff line change 1
1
import VueJsonPretty from './components/tree.vue'
2
2
3
3
export default Object . assign ( { } , VueJsonPretty , {
4
- version : '1.1.0 '
4
+ version : '1.1.1 '
5
5
} )
You can’t perform that action at this time.
0 commit comments