2
0
mirror of https://github.com/tenrok/vue-json-viewer.git synced 2026-06-05 16:42:30 +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() |
| `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 () {
+2
View File
@@ -21,6 +21,7 @@ export default {
forceExpand: Boolean,
previewMode: Boolean,
showArrayIndex: Boolean,
showDoubleQuotes: Boolean,
},
data() {
return {
@@ -108,6 +109,7 @@ export default {
previewMode: this.previewMode,
forceExpand: this.forceExpand,
showArrayIndex: this.showArrayIndex,
showDoubleQuotes: this.showDoubleQuotes,
}
}))
})
+2
View File
@@ -21,6 +21,7 @@ export default {
sort: Boolean,
previewMode: Boolean,
showArrayIndex: Boolean,
showDoubleQuotes: Boolean,
},
data() {
return {
@@ -119,6 +120,7 @@ export default {
previewMode: this.previewMode,
forceExpand: this.forceExpand,
showArrayIndex: this.showArrayIndex,
showDoubleQuotes: this.showDoubleQuotes,
}
}))
}