File tree Expand file tree Collapse file tree 1 file changed +16
-21
lines changed Expand file tree Collapse file tree 1 file changed +16
-21
lines changed Original file line number Diff line number Diff line change @@ -182,16 +182,7 @@ export default {
182
182
return {
183
183
translateY: 0 ,
184
184
visibleData: null ,
185
- hiddenPaths: jsonFlatten (this .data , this .rootPath ).reduce ((acc , item ) => {
186
- const depthComparison = item .level >= this .deep ;
187
- if ((item .type === ' objectStart' || item .type === ' arrayStart' ) && depthComparison) {
188
- return {
189
- ... acc,
190
- [item .path ]: 1 ,
191
- };
192
- }
193
- return acc;
194
- }, {}),
185
+ hiddenPaths: this .initHiddenPaths (jsonFlatten (this .data , this .rootPath ), this .deep ),
195
186
};
196
187
},
197
188
computed: {
@@ -271,21 +262,25 @@ export default {
271
262
},
272
263
273
264
deep: {
274
- handler () {
275
- this .hiddenPaths = jsonFlatten (this .data , this .rootPath ).reduce ((acc , item ) => {
276
- const depthComparison = item .level >= this .deep ;
277
- if ((item .type === ' objectStart' || item .type === ' arrayStart' ) && depthComparison) {
278
- return {
279
- ... acc,
280
- [item .path ]: 1 ,
281
- };
282
- }
283
- return acc;
284
- }, {});
265
+ handler (val ) {
266
+ this .hiddenPaths = this .initHiddenPaths (this .originFlatData , val);
285
267
},
286
268
},
287
269
},
288
270
methods: {
271
+ initHiddenPaths (originFlatData , deep ) {
272
+ return originFlatData .reduce ((acc , item ) => {
273
+ const depthComparison = item .level >= deep;
274
+ if ((item .type === ' objectStart' || item .type === ' arrayStart' ) && depthComparison) {
275
+ return {
276
+ ... acc,
277
+ [item .path ]: 1 ,
278
+ };
279
+ }
280
+ return acc;
281
+ }, {});
282
+ },
283
+
289
284
updateVisibleData (flatDataValue ) {
290
285
if (this .virtual ) {
291
286
const visibleCount = this .height / this .itemHeight ;
You can’t perform that action at this time.
0 commit comments