add change showFilter by mouseleave on my-filter

This commit is contained in:
ogerly 2023-02-07 16:40:33 +01:00
parent e8ce152f06
commit df22c7289e
4 changed files with 14 additions and 5 deletions

View File

@ -6,7 +6,7 @@
:filled="!filteredCategoryIds.length"
:label="$t('filter-menu.all')"
icon="check"
@click="resetCategories"
@click="setResetCategories"
/>
</li>
<li class="item item-save-topics">
@ -62,6 +62,10 @@ export default {
resetCategories: 'posts/RESET_CATEGORIES',
toggleCategory: 'posts/TOGGLE_CATEGORY',
}),
setResetCategories() {
this.resetCategories()
this.$emit('showFilterMenu')
},
saveCategories() {
this.$apollo
.mutate({
@ -69,6 +73,7 @@ export default {
variables: { activeCategories: this.filteredCategoryIds },
})
.then(() => {
this.$emit('showFilterMenu')
this.$toast.success(this.$t('filter-menu.save.success'))
})
.catch(() => {

View File

@ -3,7 +3,7 @@
<div class="filter-menu-options">
<h2 class="title">{{ $t('filter-menu.filter-by') }}</h2>
<following-filter />
<categories-filter v-if="categoriesActive" />
<categories-filter v-if="categoriesActive" @showFilterMenu="$emit('showFilterMenu')" />
</div>
<div class="filter-menu-options">
<h2 class="title">{{ $t('filter-menu.order-by') }}</h2>

View File

@ -179,7 +179,9 @@
style="text-align: center"
>
<client-only>
<group-button />
<div @click="toggleMobileMenuView">
<group-button />
</div>
</client-only>
</ds-flex-item>
<!-- map button -->

View File

@ -66,7 +66,9 @@
</span>
<div id="my-filter" v-if="showFilter">
<filter-menu-component />
<div @mouseleave="showFilter = false">
<filter-menu-component @showFilterMenu="showFilterMenu" />
</div>
</div>
</div>
</div>
@ -203,7 +205,7 @@ export default {
toggleCategory: 'posts/TOGGLE_CATEGORY',
}),
showFilterMenu(e) {
if (!e.target.closest('#my-filter') && !e.target.closest('.my-filter-button')) {
if (!e || (!e.target.closest('#my-filter') && !e.target.closest('.my-filter-button'))) {
if (!this.showFilter) return
this.showFilter = false
}