feat: use indexDB instead of array filter

This commit is contained in:
YunYouJun
2023-07-30 18:25:54 +08:00
parent 70787d3a80
commit c2b1ffdd9e
16 changed files with 181 additions and 88 deletions

View File

@@ -1,18 +1,21 @@
<script lang="ts" setup>
import { storeToRefs } from 'pinia'
import recipes from '~/data/recipe.json'
defineProps({
const props = defineProps({
isVisible: Boolean,
})
const rStore = useRecipeStore()
const { displayedRecipe } = storeToRefs(rStore)
const showBasketBtn = computed(async () => {
return displayedRecipe.value.length !== rStore.recipesLength && props.isVisible
})
</script>
<template>
<button
v-show="displayedRecipe.length !== recipes.length && isVisible"
v-show="showBasketBtn"
class="fixed z-9 inline-flex cursor-pointer items-center justify-center rounded rounded-full shadow hover:shadow-md"
bg="green-50 dark:green-900" w="10" h="10"
bottom="18" right="4"