mirror of
https://github.com/tenrok/vue-json-viewer.git
synced 2026-06-14 18:42:31 +03:00
feat: support showArrayIndex
This commit is contained in:
@@ -40,6 +40,7 @@ new Vue({
|
||||
align: 'left'
|
||||
}}
|
||||
boxed
|
||||
show-array-index={false}
|
||||
timeformat={time => new Date(time)}
|
||||
sort></json-viewer>
|
||||
<hr />
|
||||
|
||||
+3
-1
@@ -27,6 +27,7 @@ export default {
|
||||
},
|
||||
previewMode: Boolean,
|
||||
forceExpand: Boolean,
|
||||
showArrayIndex: Boolean,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -134,7 +135,8 @@ export default {
|
||||
depth: this.depth,
|
||||
expand: this.expand,
|
||||
previewMode: this.previewMode,
|
||||
forceExpand: this.forceExpandMe
|
||||
forceExpand: this.forceExpandMe,
|
||||
showArrayIndex: this.showArrayIndex,
|
||||
},
|
||||
on: {
|
||||
'update:expand': value => {
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
:value="value"
|
||||
:sort="sort"
|
||||
:preview-mode="previewMode"
|
||||
:show-array-index="showArrayIndex"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
@@ -91,6 +92,10 @@ export default {
|
||||
previewMode: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
showArrayIndex: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
}
|
||||
},
|
||||
provide () {
|
||||
|
||||
@@ -20,6 +20,7 @@ export default {
|
||||
expand: Boolean,
|
||||
forceExpand: Boolean,
|
||||
previewMode: Boolean,
|
||||
showArrayIndex: Boolean,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -101,11 +102,12 @@ export default {
|
||||
key,
|
||||
props: {
|
||||
sort: this.sort,
|
||||
keyName: `${key}`,
|
||||
keyName: this.showArrayIndex ? `${key}`: '',
|
||||
depth: this.depth + 1,
|
||||
value,
|
||||
previewMode: this.previewMode,
|
||||
forceExpand: this.forceExpand,
|
||||
showArrayIndex: this.showArrayIndex,
|
||||
}
|
||||
}))
|
||||
})
|
||||
|
||||
@@ -20,6 +20,7 @@ export default {
|
||||
forceExpand: Boolean,
|
||||
sort: Boolean,
|
||||
previewMode: Boolean,
|
||||
showArrayIndex: Boolean,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -117,6 +118,7 @@ export default {
|
||||
value,
|
||||
previewMode: this.previewMode,
|
||||
forceExpand: this.forceExpand,
|
||||
showArrayIndex: this.showArrayIndex,
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user