From 0453d8b63482adbeafcb1c2c8381176708be3038 Mon Sep 17 00:00:00 2001 From: xujiang Date: Sun, 11 Oct 2020 03:35:06 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E8=A1=A8=E5=8D=95key?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E9=97=AE=E9=A2=98,=E4=BF=AE=E6=94=B9this?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PanelComponents/FormItems/FormItems.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/PanelComponents/FormItems/FormItems.tsx b/src/components/PanelComponents/FormItems/FormItems.tsx index a853321..2f1852a 100644 --- a/src/components/PanelComponents/FormItems/FormItems.tsx +++ b/src/components/PanelComponents/FormItems/FormItems.tsx @@ -74,6 +74,7 @@ const FormItems = (props: FormItemsProps) => { }; const handleEditItem = (item: baseFormUnion) => { + console.log(item); setVisible(true); setCurItem(item); }; @@ -89,7 +90,7 @@ const FormItems = (props: FormItemsProps) => { }; const handleSaveItem = (data: baseFormUnion) => { - let newData = formData.map(v => (v.type === data.type ? data : v)); + let newData = formData.map(v => (v.id === data.id ? data : v)); setFormData(newData); onChange && onChange(newData); setVisible(false); @@ -105,10 +106,10 @@ const FormItems = (props: FormItemsProps) => {
- + handleEditItem(item)}> - + handleDelItem(item)}>
@@ -125,7 +126,7 @@ const FormItems = (props: FormItemsProps) => {
- + handleAddItem(item)}> 添加