Hide the user menu if clicked outside of it
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2020-07-29 22:01:54 +02:00
parent aa67a6971a
commit e4f4df0655
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 5 additions and 2 deletions

View File

@ -47,7 +47,7 @@
<img :src="userInfo.getAvatarUrl()" class="avatar" alt=""/>
<div class="dropdown is-right is-active">
<div class="dropdown-trigger">
<button class="button noshadow" @click="userMenuActive = !userMenuActive">
<button class="button noshadow" @click.stop="userMenuActive = !userMenuActive">
<span class="username">{{userInfo.username}}</span>
<span class="icon is-small">
<icon icon="chevron-down"/>
@ -405,6 +405,9 @@
console.log('renewed token')
}
})
// This will hide the menu once clicked outside of it
this.$nextTick(() => document.addEventListener('click', () => this.userMenuActive = false))
},
watch: {
// call the method again if the route changes

View File

@ -241,7 +241,7 @@
created() {
this.taskService = new TaskService()
this.loadBuckets()
setTimeout(() => document.addEventListener('click', this.closeBucketDropdowns), 0)
this.$nextTick(() => document.addEventListener('click', this.closeBucketDropdowns))
// Save the current list view to local storage
// We use local storage and not vuex here to make it persistent across reloads.