debian-mirror-gitlab/app/assets/javascripts/ide/components/nav_dropdown.vue

60 lines
1.2 KiB
Vue
Raw Normal View History

2018-11-18 11:00:15 +05:30
<script>
import $ from 'jquery';
import Icon from '~/vue_shared/components/icon.vue';
import NavForm from './nav_form.vue';
import NavDropdownButton from './nav_dropdown_button.vue';
export default {
components: {
Icon,
NavDropdownButton,
NavForm,
},
data() {
return {
isVisibleDropdown: false,
};
},
mounted() {
this.addDropdownListeners();
},
beforeDestroy() {
this.removeDropdownListeners();
},
methods: {
addDropdownListeners() {
$(this.$refs.dropdown)
.on('show.bs.dropdown', () => this.showDropdown())
.on('hide.bs.dropdown', () => this.hideDropdown());
},
removeDropdownListeners() {
$(this.$refs.dropdown)
.off('show.bs.dropdown')
.off('hide.bs.dropdown');
},
showDropdown() {
this.isVisibleDropdown = true;
},
hideDropdown() {
this.isVisibleDropdown = false;
},
},
};
</script>
<template>
2019-01-03 12:48:30 +05:30
<div
ref="dropdown"
class="btn-group ide-nav-dropdown dropdown"
>
2018-11-18 11:00:15 +05:30
<nav-dropdown-button />
2019-01-03 12:48:30 +05:30
<div
class="dropdown-menu dropdown-menu-left p-0"
>
<nav-form
v-if="isVisibleDropdown"
/>
</div>
2018-11-18 11:00:15 +05:30
</div>
</template>