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

feat: fix some issues

This commit is contained in:
风棋
2021-01-13 20:18:08 +08:00
parent 6f310879ef
commit 054b4089c7
7 changed files with 35 additions and 13 deletions
+4 -3
View File
@@ -70,9 +70,9 @@ export default {
} else if (typeof this.value === 'function') {
dataType = JsonFunction
}
const toggle = this.keyName && (this.value && (Array.isArray(this.value) || (typeof this.value === 'object' && Object.prototype.toString.call(this.value) !== '[object Date]')))
const complex = this.keyName && (this.value && (Array.isArray(this.value) || (typeof this.value === 'object' && Object.prototype.toString.call(this.value) !== '[object Date]')))
if (!this.previewMode && toggle) {
if (!this.previewMode && complex) {
elements.push(h('span', {
class: {
'jv-toggle': true,
@@ -117,7 +117,8 @@ export default {
return h('div', {
class: {
'jv-node': true,
'toggle': !this.previewMode && toggle
'jv-key-node': Boolean(this.keyName) && !complex,
'toggle': !this.previewMode && complex
}
}, elements)
}