Hide the user menu if clicked outside of it
This commit is contained in:
parent
aa67a6971a
commit
e4f4df0655
2 changed files with 5 additions and 2 deletions
|
@ -47,7 +47,7 @@
|
||||||
<img :src="userInfo.getAvatarUrl()" class="avatar" alt=""/>
|
<img :src="userInfo.getAvatarUrl()" class="avatar" alt=""/>
|
||||||
<div class="dropdown is-right is-active">
|
<div class="dropdown is-right is-active">
|
||||||
<div class="dropdown-trigger">
|
<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="username">{{userInfo.username}}</span>
|
||||||
<span class="icon is-small">
|
<span class="icon is-small">
|
||||||
<icon icon="chevron-down"/>
|
<icon icon="chevron-down"/>
|
||||||
|
@ -405,6 +405,9 @@
|
||||||
console.log('renewed token')
|
console.log('renewed token')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// This will hide the menu once clicked outside of it
|
||||||
|
this.$nextTick(() => document.addEventListener('click', () => this.userMenuActive = false))
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// call the method again if the route changes
|
// call the method again if the route changes
|
||||||
|
|
|
@ -241,7 +241,7 @@
|
||||||
created() {
|
created() {
|
||||||
this.taskService = new TaskService()
|
this.taskService = new TaskService()
|
||||||
this.loadBuckets()
|
this.loadBuckets()
|
||||||
setTimeout(() => document.addEventListener('click', this.closeBucketDropdowns), 0)
|
this.$nextTick(() => document.addEventListener('click', this.closeBucketDropdowns))
|
||||||
|
|
||||||
// Save the current list view to local storage
|
// Save the current list view to local storage
|
||||||
// We use local storage and not vuex here to make it persistent across reloads.
|
// We use local storage and not vuex here to make it persistent across reloads.
|
||||||
|
|
Loading…
Add table
Reference in a new issue