refactor: use nuxt compatiable 4 folder
This commit is contained in:
48
app/components/recipe/RecipeTable.vue
Normal file
48
app/components/recipe/RecipeTable.vue
Normal file
@@ -0,0 +1,48 @@
|
||||
<script lang="ts" setup>
|
||||
import type { Recipes } from '~/types'
|
||||
|
||||
defineProps<{
|
||||
recipes: Recipes
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<table
|
||||
class="recipe-table bg-$c-bg"
|
||||
overflow="auto" h="full"
|
||||
>
|
||||
<thead>
|
||||
<tr>
|
||||
<th />
|
||||
<th>
|
||||
名称
|
||||
</th>
|
||||
<th>
|
||||
工具
|
||||
</th>
|
||||
<th>
|
||||
材料
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<RecipeTableItem
|
||||
v-for="(recipe, i) in recipes"
|
||||
:key="recipe.name"
|
||||
:index="i" :recipe="recipe"
|
||||
/>
|
||||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
.recipe-table {
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
tr,
|
||||
th,
|
||||
td {
|
||||
border: 1px solid black;
|
||||
}
|
||||
</style>
|
||||
31
app/components/recipe/RecipeTableItem.vue
Normal file
31
app/components/recipe/RecipeTableItem.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
<script lang="ts" setup>
|
||||
import type { RecipeItem } from '~/types'
|
||||
|
||||
defineProps<{
|
||||
index: number
|
||||
recipe: RecipeItem
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<tr>
|
||||
<td>
|
||||
{{ index }}
|
||||
</td>
|
||||
<td>
|
||||
<a
|
||||
class="text-blue-500" font-bold
|
||||
:href="recipe.link || `https://www.bilibili.com/video/${recipe.bv}`"
|
||||
target="_blank"
|
||||
>
|
||||
{{ recipe.name }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ recipe.tools.join('、') }}
|
||||
</td>
|
||||
<td>
|
||||
{{ recipe.stuff.join('、') }}
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
Reference in New Issue
Block a user