mirror of
https://github.com/tenrok/vue-json-viewer.git
synced 2026-06-20 20:00:37 +03:00
feat: Optimize memory
This commit is contained in:
+16
-14
@@ -94,20 +94,22 @@ export default {
|
||||
innerText: '['
|
||||
}
|
||||
}))
|
||||
this.ordered.forEach((value, key) => {
|
||||
elements.push(h(JsonBox, {
|
||||
key,
|
||||
style: {
|
||||
display: this.expand ? undefined : 'none'
|
||||
},
|
||||
props: {
|
||||
sort: this.sort,
|
||||
// keyName: key,
|
||||
depth: this.depth + 1,
|
||||
value,
|
||||
}
|
||||
}))
|
||||
})
|
||||
if (this.expand) {
|
||||
this.ordered.forEach((value, key) => {
|
||||
elements.push(h(JsonBox, {
|
||||
key,
|
||||
style: {
|
||||
display: this.expand ? undefined : 'none'
|
||||
},
|
||||
props: {
|
||||
sort: this.sort,
|
||||
// keyName: key,
|
||||
depth: this.depth + 1,
|
||||
value,
|
||||
}
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
if (!this.expand && this.value.length) {
|
||||
elements.push(h('span', {
|
||||
|
||||
+17
-15
@@ -91,22 +91,24 @@ export default {
|
||||
}
|
||||
}))
|
||||
|
||||
for (let key in this.ordered) {
|
||||
if (this.ordered.hasOwnProperty(key)) {
|
||||
let value = this.ordered[key]
|
||||
if (this.expand) {
|
||||
for (let key in this.ordered) {
|
||||
if (this.ordered.hasOwnProperty(key)) {
|
||||
let value = this.ordered[key]
|
||||
|
||||
elements.push(h(JsonBox, {
|
||||
key,
|
||||
style: {
|
||||
display: !this.expand ? 'none' : undefined
|
||||
},
|
||||
props: {
|
||||
sort: this.sort,
|
||||
keyName: key,
|
||||
depth: this.depth + 1,
|
||||
value,
|
||||
}
|
||||
}))
|
||||
elements.push(h(JsonBox, {
|
||||
key,
|
||||
style: {
|
||||
display: !this.expand ? 'none' : undefined
|
||||
},
|
||||
props: {
|
||||
sort: this.sort,
|
||||
keyName: key,
|
||||
depth: this.depth + 1,
|
||||
value,
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user