Bootstrap

前端项目实战240-ant design表格编辑行要按照id编辑

  const handleSave = (row: DataType) => {
        const newData: any = [...menuData.list];
        const index = newData.findIndex((item: any) => row?.id == item.id);
        const item = newData[index];
        newData.splice(index, 1, {
            ...item,
            ...row,
        });
        console.log(newData, "newDatanewDatanewDatanewData")
        setMenuData({
            list: newData, page: {
                dataTotal: menuData.page.dataTotal,
                size: menuData.page.size,
            }
        });
    };

;