2
0
mirror of https://github.com/tenrok/vue-json-viewer.git synced 2026-06-23 20:40:38 +03:00

Merge pull request #15 from s-mage/master

Improve displaying of objects and arrays
This commit is contained in:
陈峰
2019-05-31 21:21:13 +08:00
committed by GitHub
2 changed files with 14 additions and 16 deletions
+5 -7
View File
@@ -69,13 +69,11 @@ export default {
}
}))
for (let key in this.ordered) {
let value = this.ordered[key]
this.ordered.forEach((value, key) => {
elements.push(h(JsonBox, {
key,
style: {
display: !this.expand ? 'none' : undefined
display: this.expand ? undefined : 'none'
},
props: {
sort: this.sort,
@@ -84,12 +82,12 @@ export default {
value,
}
}))
}
})
if (!this.expand) {
if (!this.expand && this.jsonValue.length) {
elements.push(h('span', {
style: {
display: this.expand ? 'none' : undefined
display: undefined
},
class: {
'jv-ellipsis': true,
+1 -1
View File
@@ -90,7 +90,7 @@ export default {
}
}
if (!this.expand) {
if (!this.expand && Object.keys(this.jsonValue).length) {
elements.push(h('span', {
style: {
display: this.expand ? 'none' : undefined