mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-21 10:27:44 +08:00
Fix:修复copyNodeTree工具方法克隆节点对象的数据时会把节点实例的属性也克隆的问题
This commit is contained in:
parent
f34de3acd9
commit
7533599cac
@ -190,7 +190,8 @@ export const copyNodeTree = (
|
||||
removeActiveState = false,
|
||||
removeId = true
|
||||
) => {
|
||||
tree.data = simpleDeepClone(root.nodeData ? root.nodeData.data : root.data)
|
||||
const rootData = root.nodeData ? root.nodeData : root
|
||||
tree.data = simpleDeepClone(rootData.data)
|
||||
// 移除节点uid
|
||||
if (removeId) {
|
||||
delete tree.data.uid
|
||||
@ -216,9 +217,9 @@ export const copyNodeTree = (
|
||||
})
|
||||
}
|
||||
// data、children外的其他字段
|
||||
Object.keys(root).forEach(key => {
|
||||
Object.keys(rootData).forEach(key => {
|
||||
if (!['data', 'children'].includes(key) && !/^_/.test(key)) {
|
||||
tree[key] = root[key]
|
||||
tree[key] = rootData[key]
|
||||
}
|
||||
})
|
||||
return tree
|
||||
@ -1005,6 +1006,7 @@ export const createUidForAppointNodes = (
|
||||
createNewId = false,
|
||||
handle = null
|
||||
) => {
|
||||
console.log(appointNodes)
|
||||
const walk = list => {
|
||||
list.forEach(node => {
|
||||
if (!node.data) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user