feat: adjust tool & stuff logic when not strict
This commit is contained in:
@@ -4,10 +4,12 @@ export const useRecipeStore = defineStore('recipe', () => {
|
||||
const strict = ref(false)
|
||||
|
||||
const curStuff = ref(new Set<string>())
|
||||
const curTools = ref(new Set<string>())
|
||||
// const curTools = ref(new Set<string>())
|
||||
const curTool = ref('')
|
||||
|
||||
const selectedStuff = computed(() => Array.from(curStuff.value))
|
||||
const selectedTools = computed(() => Array.from(curTools.value))
|
||||
// const selectedTools = computed(() => Array.from(curTools.value))
|
||||
// const selectedTools = ref('')
|
||||
|
||||
function toggleStuff(name: string) {
|
||||
if (!curStuff)
|
||||
@@ -19,12 +21,14 @@ export const useRecipeStore = defineStore('recipe', () => {
|
||||
}
|
||||
|
||||
function toggleTools(name: string) {
|
||||
if (!curTools)
|
||||
return
|
||||
if (curTools.value.has(name))
|
||||
curTools.value.delete(name)
|
||||
if (curTool.value === name)
|
||||
curTool.value = ''
|
||||
else
|
||||
curTools.value.add(name)
|
||||
curTool.value = name
|
||||
// if (curTools.value.has(name))
|
||||
// curTools.value.delete(name)
|
||||
// else
|
||||
// curTools.value.add(name)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,12 +36,13 @@ export const useRecipeStore = defineStore('recipe', () => {
|
||||
*/
|
||||
function reset() {
|
||||
curStuff.value.clear()
|
||||
curTools.value.clear()
|
||||
// curTools.value.clear()
|
||||
curTool.value = ''
|
||||
}
|
||||
|
||||
return {
|
||||
strict,
|
||||
selectedTools,
|
||||
curTool,
|
||||
selectedStuff,
|
||||
toggleStuff,
|
||||
toggleTools,
|
||||
|
||||
Reference in New Issue
Block a user