mirror of
https://github.com/tenrok/vue-json-viewer.git
synced 2026-06-11 18:02:29 +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,
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vue-json-viewer",
|
||||
"version": "2.2.3",
|
||||
"version": "2.2.4",
|
||||
"description": "vuejs展示json的组件",
|
||||
"main": "vue-json-viewer.js",
|
||||
"files": [
|
||||
|
||||
Reference in New Issue
Block a user