2
0
mirror of https://github.com/tenrok/vue-json-viewer.git synced 2026-06-23 20:40:38 +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
+2
View File
@@ -94,6 +94,7 @@ export default {
innerText: '[' innerText: '['
} }
})) }))
if (this.expand) {
this.ordered.forEach((value, key) => { this.ordered.forEach((value, key) => {
elements.push(h(JsonBox, { elements.push(h(JsonBox, {
key, key,
@@ -108,6 +109,7 @@ export default {
} }
})) }))
}) })
}
if (!this.expand && this.value.length) { if (!this.expand && this.value.length) {
elements.push(h('span', { elements.push(h('span', {
+2
View File
@@ -91,6 +91,7 @@ export default {
} }
})) }))
if (this.expand) {
for (let key in this.ordered) { for (let key in this.ordered) {
if (this.ordered.hasOwnProperty(key)) { if (this.ordered.hasOwnProperty(key)) {
let value = this.ordered[key] let value = this.ordered[key]
@@ -109,6 +110,7 @@ export default {
})) }))
} }
} }
}
if (!this.expand && Object.keys(this.value).length) { if (!this.expand && Object.keys(this.value).length) {
elements.push(h('span', { elements.push(h('span', {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "vue-json-viewer", "name": "vue-json-viewer",
"version": "2.2.3", "version": "2.2.4",
"description": "vuejs展示json的组件", "description": "vuejs展示json的组件",
"main": "vue-json-viewer.js", "main": "vue-json-viewer.js",
"files": [ "files": [