mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 15:49:42 +02:00
Allow tags/categories/tools deletion (#1142)
* feat: allow tags/categories/tools deletion * Use gray color for delete action
This commit is contained in:
parent
aff30adda6
commit
60682dba75
5 changed files with 267 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<v-container>
|
||||
<RecipeCategoryTagToolPage v-if="tools" :items="tools" item-type="tools" />
|
||||
<RecipeCategoryTagToolPage v-if="tools" :items="tools" item-type="tools" @delete="removeTool" />
|
||||
</v-container>
|
||||
</template>
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
|||
import { defineComponent, useAsync } from "@nuxtjs/composition-api";
|
||||
import RecipeCategoryTagToolPage from "~/components/Domain/Recipe/RecipeCategoryTagToolPage.vue";
|
||||
import { useUserApi } from "~/composables/api";
|
||||
import { useAsyncKey } from "~/composables/use-utils";
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
|
@ -21,9 +22,22 @@ export default defineComponent({
|
|||
if (data) {
|
||||
return data;
|
||||
}
|
||||
});
|
||||
}, useAsyncKey());
|
||||
|
||||
function removeTool(id: string) {
|
||||
if (tools.value) {
|
||||
for (let i = 0; i < tools.value.length; i++) {
|
||||
if (tools.value[i].id === id) {
|
||||
tools.value.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
tools,
|
||||
removeTool,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue