Commit 82d8d4d2 authored by janis.streib's avatar janis.streib 🦉
Browse files

UPD: made resolveParanet array compatible

parent ab57a126
......@@ -102,23 +102,36 @@
}
},
watch: {
$route(to, from) {
$route() {
var m = this.$router.currentRoute.matched
m = m[m.length - 1]
this.breadcrumbs = this.gen_bread(m)
}
},
methods: {
gen_bread(m) {
var res = [{text: m.meta.resolveName(this.$route.params), path: m.path}]
while ((m.meta && m.meta.resolveParent) || m.parent) {
if (m.meta && m.meta.resolveParent) {
m = this.$router.resolve(m.meta.resolveParent(this.$route.params)).resolved.matched
m = m[m.length-1]
while ((m.meta && m.meta.resolveParents) || m.parent) {
if (m.meta && m.meta.resolveParents) {
let parents = m.meta.resolveParents(this.$route.params)
for(let i=0;i<parents.length;i++) {
if(typeof parents[i] === 'object' && 'text' in parents[i] && 'to' in parents[i]) {
res.unshift(parents[i])
continue
}
m = this.$router.resolve(parents[i]).resolved.matched
window.console.debug(m)
m = m[m.length - 1]
res.unshift({text: m.meta.resolveName(this.$route.params), to: parents[i]})
}
} else {
m = m.parent
res.unshift({text: m.meta.resolveName(this.$route.params), to: m.path})
}
res.unshift({text: m.meta.resolveName(this.$route.params), to: m.path})
}
this.breadcrumbs = res
}
},
methods: {
return res
},
upd_bread() {
var m = this.$router.currentRoute.matched
var res = []
......
......@@ -56,8 +56,8 @@ export default new Router({
resolveName: function (query) {
return query.name + '/'+query.suffix
},
resolveParent: function(query) {
return '/dnsvs/ranges'
resolveParents: function(query) {
return ['/dnsvs/ranges']
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment