feat: fix new Set store & add alias judge

This commit is contained in:
YunYouJun
2022-04-14 20:40:34 +08:00
parent 24b1685f35
commit d8ab8b8e05
5 changed files with 48 additions and 12 deletions

View File

@@ -2,8 +2,11 @@ import { acceptHMRUpdate, defineStore } from 'pinia'
export const useRecipeStore = defineStore('recipe', () => {
const curStuff = ref(new Set<string>())
const selectedStuff = computed(() => Array.from(curStuff.value))
function toggleStuff(name: string) {
if (!curStuff)
return
if (curStuff.value.has(name))
curStuff.value.delete(name)
else
@@ -11,7 +14,7 @@ export const useRecipeStore = defineStore('recipe', () => {
}
return {
curStuff,
selectedStuff,
toggleStuff,
}
})