feat: add user about page

This commit is contained in:
YunYouJun
2023-07-30 20:13:20 +08:00
parent 44c9631e70
commit 2db9fee8af
20 changed files with 236 additions and 1191 deletions

View File

@@ -1,12 +1,21 @@
import recipeData from '~/data/recipe.json'
import type { RecipeItem, Recipes } from '~/types'
export function useRandomRecipe() {
const randomRecipe = ref<RecipeItem>()
/**
* 随机几道菜
* @param total
* @returns
*/
export function useRandomRecipe(total: Ref<number>) {
const randomRecipes = ref<RecipeItem[]>([])
function random() {
randomRecipe.value = generateRandomRecipe(recipeData as Recipes)
randomRecipes.value = generateRandomRecipe(recipeData as Recipes, total.value)
}
watch(total, () => {
random()
})
onMounted(() => {
random()
})
@@ -14,6 +23,6 @@ export function useRandomRecipe() {
return {
random,
randomRecipe,
randomRecipes,
}
}