2018-07-14 14:41:31 +00:00
|
|
|
<template>
|
2018-09-28 13:10:48 +00:00
|
|
|
<div class="dropdown show" ref="dropdownMenu" v-on-outside-click="hideDropdown">
|
2018-07-15 07:00:47 +00:00
|
|
|
<button
|
2018-07-14 16:31:08 +00:00
|
|
|
: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"
|
|
|
|
>
|
2018-07-14 16:31:08 +00:00
|
|
|
{{ 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"
|
|
|
|
>
|
2018-07-14 16:31:08 +00:00
|
|
|
{{ 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-09-28 13:10:48 +00:00
|
|
|
};
|
2018-09-20 12:43:13 +00:00
|
|
|
},
|
2018-09-28 13:10:48 +00:00
|
|
|
methods: {
|
|
|
|
hideDropdown() {
|
|
|
|
this.isShown = false;
|
2018-09-20 12:43:13 +00:00
|
|
|
}
|
2018-09-28 13:10:48 +00:00
|
|
|
}
|
2018-07-14 16:31:08 +00:00
|
|
|
};
|
2018-07-14 14:41:31 +00:00
|
|
|
</script>
|
2018-07-15 07:00:47 +00:00
|
|
|
<style lang="scss">
|
2018-09-28 13:10:48 +00:00
|
|
|
@import '../styles/variables.scss';
|
2018-07-15 07:00:47 +00:00
|
|
|
$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>
|