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

add getPath methods

return path from root
This commit is contained in:
vtejuf
2021-10-09 11:52:02 +08:00
committed by GitHub
parent 08c57d5fe1
commit f849440d09
+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) {