Merge pull request #279 from AndreMiras/feature/staking_nav_link

Breadcrumb navigation links
This commit is contained in:
ping 2022-12-01 12:17:26 +08:00 committed by GitHub
commit d50d9edf06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 7 deletions

View File

@ -31,7 +31,7 @@
{{ chainname }}
</b-breadcrumb-item>
<b-breadcrumb-item
v-for="item in $route.meta.breadcrumb"
v-for="item in breadcrumb"
:key="item.text"
:active="item.active"
:to="item.to"
@ -75,6 +75,14 @@ export default {
chainname() {
return this.$store?.state?.chains?.selected?.chain_name
},
/**
* Invoke `route.meta.breadcrumb($route)` if breadcrumb is callable.
*/
breadcrumb() {
const { breadcrumb } = this.$route.meta
const breadcrumbIsCallable = typeof breadcrumb === 'function'
return breadcrumbIsCallable ? breadcrumb(this.$route) : breadcrumb
},
},
}
</script>

View File

@ -249,16 +249,16 @@ const router = new VueRouter({
component: () => import('@/views/StakingValidator.vue'),
meta: {
pageTitle: 'Staking Validator',
breadcrumb: [
breadcrumb: route => ([
{
text: 'Staking',
active: true,
to: `/${route.params.chain}/staking`,
},
{
text: 'Validator',
active: true,
},
],
]),
},
},
{
@ -317,16 +317,16 @@ const router = new VueRouter({
component: () => import('@/views/Block.vue'),
meta: {
pageTitle: 'Block',
breadcrumb: [
breadcrumb: route => ([
{
text: 'Blocks',
active: true,
to: `/${route.params.chain}/blocks`,
},
{
text: 'Block',
active: true,
},
],
]),
},
},
{