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

Merge pull request #88 from vikrambiwal/master

Add support for Double Quotes on keys
This commit is contained in:
陈峰
2022-03-03 18:52:13 +08:00
committed by GitHub
5 changed files with 13 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 () {
+2
View File
@@ -21,6 +21,7 @@ export default {
forceExpand: Boolean, forceExpand: Boolean,
previewMode: Boolean, previewMode: Boolean,
showArrayIndex: Boolean, showArrayIndex: Boolean,
showDoubleQuotes: Boolean,
}, },
data() { data() {
return { return {
@@ -108,6 +109,7 @@ export default {
previewMode: this.previewMode, previewMode: this.previewMode,
forceExpand: this.forceExpand, forceExpand: this.forceExpand,
showArrayIndex: this.showArrayIndex, showArrayIndex: this.showArrayIndex,
showDoubleQuotes: this.showDoubleQuotes,
} }
})) }))
}) })
+2
View File
@@ -21,6 +21,7 @@ export default {
sort: Boolean, sort: Boolean,
previewMode: Boolean, previewMode: Boolean,
showArrayIndex: Boolean, showArrayIndex: Boolean,
showDoubleQuotes: Boolean,
}, },
data() { data() {
return { return {
@@ -119,6 +120,7 @@ export default {
previewMode: this.previewMode, previewMode: this.previewMode,
forceExpand: this.forceExpand, forceExpand: this.forceExpand,
showArrayIndex: this.showArrayIndex, showArrayIndex: this.showArrayIndex,
showDoubleQuotes: this.showDoubleQuotes,
} }
})) }))
} }