diff --git a/src/components/ChooseFood.vue b/src/components/ChooseFood.vue index 4a900e3..cb4656d 100644 --- a/src/components/ChooseFood.vue +++ b/src/components/ChooseFood.vue @@ -4,7 +4,7 @@ import { storeToRefs } from 'pinia' import type { StuffItem } from '~/data/food' import { meat, staple, tools, vegetable } from '~/data/food' import recipeData from '~/data/recipe.json' -import type { Recipe } from '~/types' +import type { Recipe, RecipeItem } from '~/types' import { useRecipeStore } from '~/stores/recipe' import { useInvisibleElement } from '~/composables/helper' @@ -99,6 +99,13 @@ const clickTool = (item: StuffItem) => { const recipePanel = ref() const { isVisible, show } = useInvisibleElement(recipePanel) + + + +function generateRandomRecipe() { + return recipe.value[Math.floor(Math.random() * recipe.value.length)] +} +const randomRecipe = ref(generateRandomRecipe())