chore: import json data and display
This commit is contained in:
1
src/components.d.ts
vendored
1
src/components.d.ts
vendored
@@ -5,6 +5,7 @@
|
||||
declare module '@vue/runtime-core' {
|
||||
export interface GlobalComponents {
|
||||
BaseFooter: typeof import('./components/BaseFooter.vue')['default']
|
||||
ChooseFood: typeof import('./components/ChooseFood.vue')['default']
|
||||
Counter: typeof import('./components/Counter.vue')['default']
|
||||
Menu: typeof import('./components/Menu.vue')['default']
|
||||
README: typeof import('./components/README.md')['default']
|
||||
|
||||
11
src/components/ChooseFood.vue
Normal file
11
src/components/ChooseFood.vue
Normal file
@@ -0,0 +1,11 @@
|
||||
<script lang="ts" setup>
|
||||
import recipeData from '~/data/recipe.json'
|
||||
import type { Recipe } from '~/types'
|
||||
const recipe = ref(recipeData as Recipe)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<span v-for="item, i in recipe" :key="i" class="tag">{{ item.name }}</span>
|
||||
</div>
|
||||
</template>
|
||||
3
src/data/recipe.csv
Normal file
3
src/data/recipe.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
名称,食材,链接,标签/描述,方法,工具
|
||||
干锅土豆片,土豆,https://www.bilibili.com/video/BV1ZZ4y1A7HK,下饭,炒,锅
|
||||
罗宋汤,土豆、西红柿、洋葱,https://www.bilibili.com/video/BV1gP4y1T7Z7,简易版,煮,锅
|
||||
|
@@ -5,6 +5,8 @@ import App from './App.vue'
|
||||
|
||||
import '@unocss/reset/tailwind.css'
|
||||
import './styles/main.css'
|
||||
import './styles/css-vars.scss'
|
||||
import './styles/index.scss'
|
||||
import 'uno.css'
|
||||
|
||||
const routes = setupLayouts(generatedRoutes)
|
||||
|
||||
@@ -6,5 +6,8 @@
|
||||
<p m="2">
|
||||
好的,今天我们来做菜!
|
||||
</p>
|
||||
<p>
|
||||
<ChooseFood />
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
:root {
|
||||
--c-primary: #5fc178;
|
||||
--c-text: #333;
|
||||
|
||||
--c-bg: #fff;
|
||||
}
|
||||
|
||||
.dark {
|
||||
--c-text: #fafafa;
|
||||
|
||||
--c-bg: #121212;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
html {
|
||||
color: var(--c-text);
|
||||
background-color: var(--c-bg);
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--c-text);
|
||||
}
|
||||
|
||||
.tag {
|
||||
margin: 4px;
|
||||
padding: 2px 4px;
|
||||
border: 1px solid var(--c-text);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user