2
0
mirror of https://github.com/tenrok/vue-json-viewer.git synced 2026-06-14 18:42:31 +03:00

Merge pull request #79 from vtejuf/feature/get-path

给box加getPath方法
This commit is contained in:
陈峰
2021-10-30 17:23:14 +08:00
committed by GitHub
2 changed files with 12 additions and 1 deletions
+11
View File
@@ -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) {
+1 -1
View File
@@ -92,7 +92,7 @@ export default {
},
props: {
sort: this.sort,
// keyName: key,
keyName: `${key}`,
depth: this.depth + 1,
value,
previewMode: this.previewMode,