diff --git a/History.md b/History.md index 7f5a57b..ac175ad 100644 --- a/History.md +++ b/History.md @@ -1,5 +1,11 @@ ## 2.2.17 2020-12-29 +- fix: issues [issues](https://github.com/chenfengjw163/vue-json-viewer/issues/64) +- fix: issues [issues](https://github.com/chenfengjw163/vue-json-viewer/issues/65) +- fix: issues [issues](https://github.com/chenfengjw163/vue-json-viewer/issues/66) + +## 2.2.17 2020-12-29 + - fix: long string expand arrow display error [pr](https://github.com/chenfengjw163/vue-json-viewer/pull/62) ## 2.2.16 2020-11-13 diff --git a/example/app.css b/example/app.css index acce3ab..06dea9f 100644 --- a/example/app.css +++ b/example/app.css @@ -1,3 +1,6 @@ .jv-number-float { color: #faa !important; +} +.jv-key-node { + display: flex; } \ No newline at end of file diff --git a/example/app.js b/example/app.js index 40ea7d2..5500ea1 100644 --- a/example/app.js +++ b/example/app.js @@ -36,7 +36,8 @@ new Vue({ expand-depth={5} copyable={{ copyText: '复制', - copiedText: '复制成功' + copiedText: '复制成功', + align: 'left' }} boxed timeformat={time => new Date(time)} @@ -46,7 +47,8 @@ new Vue({ value={this.jsonData} expand-depth={1} copyable={{ - timeout: 4000 + timeout: 4000, + align: 'left' }} scopedSlots={scopedSlots} onCopied={onCopied}> diff --git a/lib/json-box.vue b/lib/json-box.vue index 53ebf6c..c4bd53f 100644 --- a/lib/json-box.vue +++ b/lib/json-box.vue @@ -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) } diff --git a/lib/json-viewer.vue b/lib/json-viewer.vue index aa4181f..9250d6a 100644 --- a/lib/json-viewer.vue +++ b/lib/json-viewer.vue @@ -2,7 +2,7 @@