feat: add tool icon for dish
This commit is contained in:
@@ -8,11 +8,7 @@ import { meat, staple, tools, vegetable } from '~/data/food'
|
||||
import recipeData from '~/data/recipe.json'
|
||||
import type { Recipe } from '~/types'
|
||||
import { useRecipeStore } from '~/stores/recipe'
|
||||
import { generateEmojisFromStuff } from '~/utils'
|
||||
|
||||
(recipeData as Recipe).forEach((recipe) => {
|
||||
recipe.emojis = generateEmojisFromStuff(recipe.stuff)
|
||||
})
|
||||
const recipe = ref<Recipe>(recipeData as Recipe)
|
||||
|
||||
const rStore = useRecipeStore()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import { useGtm } from '@gtm-support/vue-gtm'
|
||||
import { tools } from '~/data/food'
|
||||
import type { RecipeItem } from '~/types'
|
||||
defineProps<{
|
||||
dish: RecipeItem
|
||||
@@ -15,6 +16,7 @@ const triggerGtm = (val: string) => {
|
||||
label: '跳转菜谱',
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -24,6 +26,9 @@ const triggerGtm = (val: string) => {
|
||||
bg="blue-300 opacity-20"
|
||||
@click="triggerGtm(dish.name)"
|
||||
>
|
||||
<span text="sm blue-700 dark:blue-200">{{ dish.emojis.join(' ') + ' ' + dish.name }}</span>
|
||||
<span m="r-1" class="inline-flex justify-center items-center" text="sm blue-700 dark:blue-200">{{ dish.emojis.join(' ') + ' ' + dish.name }}</span>
|
||||
<span v-for="tool, i in tools" :key="i" inline-flex>
|
||||
<div v-if="dish.tools?.includes(tool.name)" :class="tool.icon" />
|
||||
</span>
|
||||
</a>
|
||||
</template>
|
||||
|
||||
@@ -25,8 +25,7 @@ title: 关于
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
如果您有任何建议或反馈可前往 [Issues](https://github.com/YunYouJun/cook/issues) / [Discussions](https://github.com/YunYouJun/cook/issues)。
|
||||
|
||||
<div class="flex justify-center items-center">
|
||||
Made by
|
||||
|
||||
Reference in New Issue
Block a user