fix: useStorage in ssr & extract random

This commit is contained in:
YunYouJun
2023-07-30 16:31:37 +08:00
parent 033d6adbe6
commit 5164279311
13 changed files with 147 additions and 148 deletions

19
composables/recipe.ts Normal file
View File

@@ -0,0 +1,19 @@
import recipeData from '~/data/recipe.json'
import type { RecipeItem, Recipes } from '~/types'
export function useRandomRecipe() {
const randomRecipe = ref<RecipeItem>()
function random() {
randomRecipe.value = generateRandomRecipe(recipeData as Recipes)
}
onMounted(() => {
random()
})
return {
random,
randomRecipe,
}
}