【发布时间】:2021-01-08 11:25:32
【问题描述】:
我会尝试做一个 react-sortable-tree Crud 操作。编辑后我很难更新数据。请任何人澄清我的问题。我会在下面附上我的代码沙箱实时链接。
https://codesandbox.io/s/zealous-browser-06fqg?file=/src/App.js
【问题讨论】:
标签: javascript html css reactjs fluent-ui
我会尝试做一个 react-sortable-tree Crud 操作。编辑后我很难更新数据。请任何人澄清我的问题。我会在下面附上我的代码沙箱实时链接。
https://codesandbox.io/s/zealous-browser-06fqg?file=/src/App.js
【问题讨论】:
标签: javascript html css reactjs fluent-ui
//Update node
const updateNode = (rowInfo, data) => {
// console.log(data, "data")
console.log(numbers, "array position");
console.log(path, "path position");
console.log(rowInfo, "rowInfo value");
var treeIndex = numbers;
var paths = path;
console.log(treeIndex, "treeIndex position");
if (action === "edit") {
treeData[treeIndex].title = rowInfo;
settreeData([...treeData]);
setaction("add");
} else {
settreeData([...treeData, { title: rowInfo }]);
alert("hello");
setaction("add");
}
};
【讨论】: