mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-19 05:09:40 +02:00
fix: Refresh recipe section when clicking card tag chip (#4810)
Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
parent
4b992afc67
commit
203218a3d5
8 changed files with 61 additions and 16 deletions
|
@ -23,13 +23,13 @@
|
|||
<a :href="`/g/${groupSlug}/r/${item.slug}`" style="color: inherit; text-decoration: inherit; " @click="$emit('click')">{{ item.name }}</a>
|
||||
</template>
|
||||
<template #item.tags="{ item }">
|
||||
<RecipeChip small :items="item.tags" :is-category="false" url-prefix="tags" />
|
||||
<RecipeChip small :items="item.tags" :is-category="false" url-prefix="tags" @item-selected="filterItems" />
|
||||
</template>
|
||||
<template #item.recipeCategory="{ item }">
|
||||
<RecipeChip small :items="item.recipeCategory" />
|
||||
<RecipeChip small :items="item.recipeCategory" @item-selected="filterItems" />
|
||||
</template>
|
||||
<template #item.tools="{ item }">
|
||||
<RecipeChip small :items="item.tools" url-prefix="tools" />
|
||||
<RecipeChip small :items="item.tools" url-prefix="tools" @item-selected="filterItems" />
|
||||
</template>
|
||||
<template #item.userId="{ item }">
|
||||
<v-list-item class="justify-start">
|
||||
|
@ -48,12 +48,13 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, onMounted, ref, useContext } from "@nuxtjs/composition-api";
|
||||
import { computed, defineComponent, onMounted, ref, useContext, useRouter } from "@nuxtjs/composition-api";
|
||||
import UserAvatar from "../User/UserAvatar.vue";
|
||||
import RecipeChip from "./RecipeChips.vue";
|
||||
import { Recipe } from "~/lib/api/types/recipe";
|
||||
import { Recipe, RecipeCategory, RecipeTool } from "~/lib/api/types/recipe";
|
||||
import { useUserApi } from "~/composables/api";
|
||||
import { UserSummary } from "~/lib/api/types/user";
|
||||
import { RecipeTag } from "~/lib/api/types/household";
|
||||
|
||||
const INPUT_EVENT = "input";
|
||||
|
||||
|
@ -106,7 +107,7 @@ export default defineComponent({
|
|||
setup(props, context) {
|
||||
const { $auth, i18n } = useContext();
|
||||
const groupSlug = $auth.user?.groupSlug;
|
||||
|
||||
const router = useRouter();
|
||||
function setValue(value: Recipe[]) {
|
||||
context.emit(INPUT_EVENT, value);
|
||||
}
|
||||
|
@ -167,6 +168,13 @@ export default defineComponent({
|
|||
}
|
||||
}
|
||||
|
||||
function filterItems(item: RecipeTag | RecipeCategory | RecipeTool, itemType: string) {
|
||||
if (!groupSlug || !item.id) {
|
||||
return;
|
||||
}
|
||||
router.push(`/g/${groupSlug}?${itemType}=${item.id}`);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
refreshMembers();
|
||||
});
|
||||
|
@ -186,6 +194,7 @@ export default defineComponent({
|
|||
formatDate,
|
||||
members,
|
||||
getMember,
|
||||
filterItems,
|
||||
};
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue