2
0
mirror of https://github.com/frappe/books.git synced 2024-12-26 12:28:12 +00:00
books/ui/components/Dropdown.vue

48 lines
980 B
Vue
Raw Normal View History

2018-07-14 14:41:31 +00:00
<template>
<div class="dropdown show">
2018-07-15 07:00:47 +00:00
<button
:id="_uid"
2018-07-15 07:00:47 +00:00
class="btn btn-sm btn-light dropdown-toggle"
2018-07-14 15:01:44 +00:00
aria-haspopup="true"
2018-07-15 07:00:47 +00:00
:aria-expanded="isShown ? 'true' : 'false'"
@click="isShown = !isShown"
>
{{ label }}
2018-07-15 07:00:47 +00:00
</button>
<div :class="['dropdown-menu dropdown-menu-right', isShown ? 'show' : '']" :aria-labelledby="_uid">
<a
href="#"
class="dropdown-item"
2018-07-14 15:01:44 +00:00
v-for="option in options"
:key="option.label"
2018-07-15 07:00:47 +00:00
@click.prevent="option.handler"
>
{{ option.label }}
2018-07-14 15:01:44 +00:00
</a>
2018-07-14 14:41:31 +00:00
</div>
</div>
</template>
<script>
export default {
2018-07-15 07:00:47 +00:00
props: ['label', 'options'],
data() {
return {
isShown: false
}
}
};
2018-07-14 14:41:31 +00:00
</script>
2018-07-15 07:00:47 +00:00
<style lang="scss">
@import "../styles/variables.scss";
$dropdown-link-active-bg: $gray-300;
.dropdown-item {
&.active,
&:active {
@include gradient-bg($dropdown-link-active-bg);
}
}
2018-07-14 14:41:31 +00:00
</style>