From bff0d9eada3a284b8935bd978c3dccf5daa8ef0a Mon Sep 17 00:00:00 2001 From: YunYouJun Date: Sat, 16 Apr 2022 09:07:53 +0800 Subject: [PATCH] feat: generate emojis pre --- src/components/ChooseFood.vue | 15 ++++++++++----- src/components/DishTag.vue | 18 +----------------- src/components/ToolTag.vue | 4 ++-- src/data/food.ts | 2 +- src/types/recipe.ts | 4 ++++ src/utils/index.ts | 15 +++++++++++++++ 6 files changed, 33 insertions(+), 25 deletions(-) create mode 100644 src/utils/index.ts diff --git a/src/components/ChooseFood.vue b/src/components/ChooseFood.vue index 5973e80..a153366 100644 --- a/src/components/ChooseFood.vue +++ b/src/components/ChooseFood.vue @@ -8,7 +8,12 @@ import { meat, staple, tools, vegetable } from '~/data/food' import recipeData from '~/data/recipe.json' import type { Recipe } from '~/types' import { useRecipeStore } from '~/stores/recipe' -const recipe = ref(recipeData as Recipe) +import { generateEmojisFromStuff } from '~/utils' + +(recipeData as Recipe).forEach((recipe) => { + recipe.emojis = generateEmojisFromStuff(recipe.stuff) +}) +const recipe = ref(recipeData as Recipe) const rStore = useRecipeStore() const curStuff = computed(() => rStore.selectedStuff) @@ -65,7 +70,7 @@ const clickTool = (item: StuffItem) => {