diff --git a/lib/json-box.vue b/lib/json-box.vue index c4bd53f..fb622e2 100644 --- a/lib/json-box.vue +++ b/lib/json-box.vue @@ -47,6 +47,17 @@ export default { evt.initEvent('resized', true, false) this.$el.dispatchEvent(evt) } + }, + getPath() { + const path = [this.keyName]; + let p = this.$parent; + while(p.depth) { + if (p.$el.classList.contains('jv-node')) { + path.push(p.keyName); + } + p = p.$parent; + } + return path.reverse() } }, render (h) { diff --git a/lib/types/json-array.vue b/lib/types/json-array.vue index 41758a0..c2b40fb 100644 --- a/lib/types/json-array.vue +++ b/lib/types/json-array.vue @@ -92,7 +92,7 @@ export default { }, props: { sort: this.sort, - // keyName: key, + keyName: `${key}`, depth: this.depth + 1, value, previewMode: this.previewMode,