From 98a9a1f05e2461d40a922fd29d94751b7ccf7f5c Mon Sep 17 00:00:00 2001 From: YunYouJun Date: Mon, 9 May 2022 02:41:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20add=20=E4=BB=8A=E5=A4=A9=E5=90=83?= =?UTF-8?q?=E4=BB=80=E4=B9=88=EF=BC=88=E9=9A=8F=E6=9C=BA=E8=8F=9C=E8=B0=B1?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ChooseFood.vue | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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())