File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ plugins: [
106
106
| ------------------------ | ------ | --------------------------------------------------------------------------------------- | ---------------------------------------------- | -------- |
107
107
| data | normal | JSON data | JSON object | - |
108
108
| deep | normal | Data depth, data larger than this depth will not be expanded | number | Infinity |
109
+ | deepCollapseChildren | normal | Whether children collapsed by ` deep ` prop should also be collapsed | boolean | false |
109
110
| showLength | normal | Whether to show the length when closed | boolean | false |
110
111
| showLine | normal | Whether to show the line | boolean | true |
111
112
| showDoubleQuotes | normal | Whether to show doublequotes on key | boolean | true |
Original file line number Diff line number Diff line change @@ -55,6 +55,10 @@ export default {
55
55
type: Number ,
56
56
default: Infinity ,
57
57
},
58
+ deepCollapseChildren: {
59
+ type: Boolean ,
60
+ default: false ,
61
+ },
58
62
// 数据层级顶级路径
59
63
path: {
60
64
type: String ,
@@ -129,9 +133,12 @@ export default {
129
133
translateY: 0 ,
130
134
visibleData: null ,
131
135
hiddenPaths: jsonFlatten (this .data , this .path ).reduce ((acc , item ) => {
136
+ const depthComparison = this .deepCollapseChildren
137
+ ? item .level >= this .deep
138
+ : item .level === this .deep ;
132
139
if (
133
140
(item .type === ' objectStart' || item .type === ' arrayStart' ) &&
134
- item . level === this . deep
141
+ depthComparison
135
142
) {
136
143
return {
137
144
... acc,
You can’t perform that action at this time.
0 commit comments