2
0
mirror of https://github.com/tenrok/vue-json-viewer.git synced 2026-06-05 16:42:30 +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() |
| `preview-mode` | no expand mode | `false` |
| `show-array-index` | array show index | `true` |
| `show-double-quotes` | show double quotes | `true` |
## Listeners
+3 -1
View File
@@ -28,6 +28,7 @@ export default {
previewMode: Boolean,
forceExpand: Boolean,
showArrayIndex: Boolean,
showDoubleQuotes: Boolean,
},
data() {
return {
@@ -119,7 +120,7 @@ export default {
'jv-key': true
},
domProps: {
innerText: `${this.keyName}:`
innerText: this.showDoubleQuotes ? `"${this.keyName}":` : `${this.keyName}:`
}
}))
}
@@ -137,6 +138,7 @@ export default {
previewMode: this.previewMode,
forceExpand: this.forceExpandMe,
showArrayIndex: this.showArrayIndex,
showDoubleQuotes: this.showDoubleQuotes,
},
on: {
'update:expand': value => {
+5
View File
@@ -30,6 +30,7 @@
:sort="sort"
:preview-mode="previewMode"
:show-array-index="showArrayIndex"
:show-double-quotes="showDoubleQuotes"
/>
</div>
<div
@@ -96,6 +97,10 @@ export default {
showArrayIndex: {
type: Boolean,
default: true,
},
showDoubleQuotes: {
type: Boolean,
default: true,
}
},
provide () {