Skip to content

Commit

Permalink
feat: can delete exists tool
Browse files Browse the repository at this point in the history
  • Loading branch information
KeJunMao committed Mar 13, 2023
1 parent 38dd996 commit 61ed0a8
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions components/create/CreateForms.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts" setup>
const { step, maxStep, nextStep, prevStep, tool, isCreate } = useCreateTool();
const { save } = useCustomTools();
const { save, remove } = useCustomTools();
const localePath = useLocalePath();
const handleSave = async () => {
await save(tool.value);
Expand All @@ -14,13 +14,34 @@ const handleSave = async () => {
ElMessage.success("Update Success");
}
};
const handleRemove = async () => {
await remove(tool.value.id!);
navigateTo({
path: localePath("/"),
replace: true,
});
ElMessage.success("Delete Success");
};
</script>
<template>
<div relative>
<h2 text-xl>
{{ isCreate ? "Create" : "Update" }} Settings ({{ step + 1 }}/{{
maxStep
}})
<h2 text-xl flex justify-between>
<div>
{{ isCreate ? "Create" : "Update" }} Settings ({{ step + 1 }}/{{
maxStep
}})
</div>
<ClientOnly>
<el-popconfirm
v-if="!isCreate"
@confirm="handleRemove"
title="Are you sure to delete this?"
>
<template #reference>
<el-button type="danger">Delete</el-button>
</template>
</el-popconfirm>
</ClientOnly>
</h2>
<CreateTheInfo v-if="step === 0" />
<CreateTheForms v-else-if="step === 1" />
Expand Down

0 comments on commit 61ed0a8

Please sign in to comment.