Fix click-outside for sidebar
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<NcContent app-name="deck" :class="{ 'nav-hidden': !navShown, 'sidebar-hidden': !sidebarRouterView }">
|
<NcContent app-name="deck" :class="{ 'nav-hidden': !navShown, 'sidebar-hidden': !sidebarRouterView }">
|
||||||
<AppNavigation />
|
<AppNavigation />
|
||||||
<NcAppContent @click="clickCloseSidebar()">
|
<NcAppContent>
|
||||||
<router-view />
|
<router-view />
|
||||||
</NcAppContent>
|
</NcAppContent>
|
||||||
|
|
||||||
@@ -122,11 +122,6 @@ export default {
|
|||||||
hideModal() {
|
hideModal() {
|
||||||
this.$router.push({ name: 'board' })
|
this.$router.push({ name: 'board' })
|
||||||
},
|
},
|
||||||
clickCloseSidebar() {
|
|
||||||
if (this.sidebarShown) {
|
|
||||||
this.$router.push({ name: 'board' })
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<router-view v-if="visible" name="sidebar" />
|
<router-view v-if="visible" v-click-outside="onClickOutside" name="sidebar" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -37,6 +37,12 @@ export default {
|
|||||||
closeSidebar() {
|
closeSidebar() {
|
||||||
this.$router.push({ name: 'board' })
|
this.$router.push({ name: 'board' })
|
||||||
},
|
},
|
||||||
|
onClickOutside(e) {
|
||||||
|
if (Array.from(document.querySelectorAll('.card')).some(node => node.contains(e.target))) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.closeSidebar()
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user