2
0
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:
陈峰
2019-09-04 16:16:31 +08:00
parent 9fed43bcf5
commit 8953e9d1da
3 changed files with 34 additions and 30 deletions
+16 -14
View File
@@ -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
View File
@@ -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
View File
@@ -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": [