mirror of
https://github.com/frappe/books.git
synced 2024-11-10 15:50:56 +00:00
Sidebar
- dropdown items on title click
This commit is contained in:
parent
d59fd52ffd
commit
26380ac3f6
@ -1,10 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="frappe-sidebar col-2 bg-light border-right">
|
<div class="frappe-sidebar col-2 bg-light border-right">
|
||||||
<div class="navbar border-bottom navbar-title" @click="onNavbarTitleClick">
|
<div class="navbar border-bottom navbar-title" @click="toggleDropdown">
|
||||||
<div class="navbar-text">
|
<div class="navbar-text">
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</div>
|
</div>
|
||||||
<feather-icon class="mt-1" name="chevron-down" />
|
<feather-icon class="mt-1" name="chevron-down" />
|
||||||
|
<div :class="['dropdown-menu shadow w-100', showDropdown ? 'show' : '']">
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
class="dropdown-item"
|
||||||
|
v-for="option in sidebarConfig.titleDropdownItems"
|
||||||
|
:key="option.label"
|
||||||
|
@click.prevent="titleDropdownItemClick(option.handler)"
|
||||||
|
>
|
||||||
|
{{ option.label }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="my-3" v-for="(sidebarGroup, index) in sidebarConfig.groups" :key="index">
|
<div class="my-3" v-for="(sidebarGroup, index) in sidebarConfig.groups" :key="index">
|
||||||
<h6 v-if="sidebarGroup.title" class="sidebar-heading nav-link text-muted text-uppercase m-0">
|
<h6 v-if="sidebarGroup.title" class="sidebar-heading nav-link text-muted text-uppercase m-0">
|
||||||
@ -27,7 +38,8 @@ export default {
|
|||||||
props: ['sidebarConfig'],
|
props: ['sidebarConfig'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
title: ''
|
title: '',
|
||||||
|
showDropdown: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
@ -41,8 +53,11 @@ export default {
|
|||||||
const route = item.route.slice(1);
|
const route = item.route.slice(1);
|
||||||
return this.$route.path === route;
|
return this.$route.path === route;
|
||||||
},
|
},
|
||||||
onNavbarTitleClick() {
|
titleDropdownItemClick(handler) {
|
||||||
this.sidebarConfig.onTitleClick(this);
|
handler(this);
|
||||||
|
},
|
||||||
|
toggleDropdown(e) {
|
||||||
|
this.showDropdown = !this.showDropdown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user