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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user