From 84a72270fb0e700e6e0bb8e9133f8c3e853fa5ae Mon Sep 17 00:00:00 2001 From: "M.Palerme" Date: Tue, 7 Nov 2023 12:06:36 +0100 Subject: [PATCH] #3 delete one file --- components/ExtractInfo.vue | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/components/ExtractInfo.vue b/components/ExtractInfo.vue index 2438ef0..63fe3a8 100644 --- a/components/ExtractInfo.vue +++ b/components/ExtractInfo.vue @@ -87,12 +87,17 @@ async function getFiles(evt:Event | null):Promise{ } function deleteAll(){ - console.log("plou"); - files.splice(0, files.length) +} - console.log("next"); - +function deleteRow(id:string){ + // get index of row + const index = files.findIndex((file) => file.id == id); + + // Delete the row + if (index != undefined){ + files.splice(index,1); + } } async function extract() { @@ -180,14 +185,15 @@ defineExpose({ :loading-state="{ icon: 'i-heroicons-arrow-path-20-solid', label: labLoading }"> -