浏览代码

initValue ->value

visuddhinanda 2 年之前
父节点
当前提交
134a89e1a6
共有 1 个文件被更改,包括 12 次插入1 次删除
  1. 12 1
      dashboard/src/components/template/SentEdit/SentCanRead.tsx

+ 12 - 1
dashboard/src/components/template/SentEdit/SentCanRead.tsx

@@ -146,10 +146,21 @@ const SentCanReadWidget = ({
       {sentData.map((item, id) => {
         return (
           <SentCell
-            initValue={item}
+            value={item}
             key={id}
             isPr={false}
             editMode={item.openInEditMode}
+            onChange={(value: ISentence) => {
+              console.log("onChange", value);
+              setSentData((origin) => {
+                origin.forEach((value1, index, array) => {
+                  if (value1.id === value.id) {
+                    array[index] = value;
+                  }
+                });
+                return origin;
+              });
+            }}
           />
         );
       })}