feat: add storage for tool & stuff & strict

This commit is contained in:
YunYouJun
2022-04-19 02:14:20 +08:00
parent aee764c2d6
commit e45b23dc3f
2 changed files with 9 additions and 5 deletions

View File

@@ -38,7 +38,9 @@ title: 关于
- 晴方啾 - 晴方啾
- 课代表阿伟 - 课代表阿伟
<br /> ## **友情提示**
点击首页最上方的大锅图标,可以清空所选食材和工具。(本来想当作彩蛋,但是感觉还挺实用的。)
<div class="flex justify-center items-center"> <div class="flex justify-center items-center">
Made by Made by

View File

@@ -1,11 +1,13 @@
import { acceptHMRUpdate, defineStore } from 'pinia' import { acceptHMRUpdate, defineStore } from 'pinia'
export const useRecipeStore = defineStore('recipe', () => { const namespace = 'cook'
const strict = ref(false)
const curStuff = ref(new Set<string>()) export const useRecipeStore = defineStore('recipe', () => {
const strict = useStorage(`${namespace}:strict`, false)
const curStuff = useStorage(`${namespace}:stuff`, new Set<string>())
// const curTools = ref(new Set<string>()) // const curTools = ref(new Set<string>())
const curTool = ref('') const curTool = useStorage(`${namespace}:tool`, '')
const selectedStuff = computed(() => Array.from(curStuff.value)) const selectedStuff = computed(() => Array.from(curStuff.value))
// const selectedTools = computed(() => Array.from(curTools.value)) // const selectedTools = computed(() => Array.from(curTools.value))