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