mirror of
https://github.com/tenrok/vue-json-viewer.git
synced 2026-06-23 20:40:38 +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)
|
evt.initEvent('resized', true, false)
|
||||||
this.$el.dispatchEvent(evt)
|
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) {
|
render (h) {
|
||||||
|
|||||||
Reference in New Issue
Block a user