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

Add support for Double Quotes on keys

This commit is contained in:
Vikram Biwal
2022-01-07 13:22:58 +05:30
parent 7b4d28cc21
commit 0a7ec9241f
3 changed files with 9 additions and 1 deletions
+1
View File
@@ -161,6 +161,7 @@ import 'vue-json-viewer/style.css'
| `timeformat` | custom time format function | time => time.toLocaleString() | | `timeformat` | custom time format function | time => time.toLocaleString() |
| `preview-mode` | no expand mode | `false` | | `preview-mode` | no expand mode | `false` |
| `show-array-index` | array show index | `true` | | `show-array-index` | array show index | `true` |
| `show-double-quotes` | show double quotes | `true` |
## Listeners ## Listeners
+3 -1
View File
@@ -28,6 +28,7 @@ export default {
previewMode: Boolean, previewMode: Boolean,
forceExpand: Boolean, forceExpand: Boolean,
showArrayIndex: Boolean, showArrayIndex: Boolean,
showDoubleQuotes: Boolean,
}, },
data() { data() {
return { return {
@@ -119,7 +120,7 @@ export default {
'jv-key': true 'jv-key': true
}, },
domProps: { domProps: {
innerText: `${this.keyName}:` innerText: this.showDoubleQuotes ? `"${this.keyName}":` : `${this.keyName}:`
} }
})) }))
} }
@@ -137,6 +138,7 @@ export default {
previewMode: this.previewMode, previewMode: this.previewMode,
forceExpand: this.forceExpandMe, forceExpand: this.forceExpandMe,
showArrayIndex: this.showArrayIndex, showArrayIndex: this.showArrayIndex,
showDoubleQuotes: this.showDoubleQuotes,
}, },
on: { on: {
'update:expand': value => { 'update:expand': value => {
+5
View File
@@ -30,6 +30,7 @@
:sort="sort" :sort="sort"
:preview-mode="previewMode" :preview-mode="previewMode"
:show-array-index="showArrayIndex" :show-array-index="showArrayIndex"
:show-double-quotes="showDoubleQuotes"
/> />
</div> </div>
<div <div
@@ -96,6 +97,10 @@ export default {
showArrayIndex: { showArrayIndex: {
type: Boolean, type: Boolean,
default: true, default: true,
},
showDoubleQuotes: {
type: Boolean,
default: true,
} }
}, },
provide () { provide () {