fix: tree data deep reactive, close #5480

pull/5485/head
tangjinzhou 2022-04-12 09:37:40 +08:00
parent 6f8c75cd6d
commit 278478b5b0
2 changed files with 2 additions and 2 deletions

View File

@ -63,7 +63,7 @@ export default function useTreeData(
rootPId: null, rootPId: null,
...(simpleModeValue !== true ? simpleModeValue : {}), ...(simpleModeValue !== true ? simpleModeValue : {}),
}) })
: toRaw(treeData.value); : toRaw(treeData.value).slice();
} else { } else {
mergedTreeData.value = convertChildrenToData(toRaw(children.value)); mergedTreeData.value = convertChildrenToData(toRaw(children.value));
} }

View File

@ -109,7 +109,7 @@ export default defineComponent({
() => { () => {
treeData.value = treeData.value =
props.treeData !== undefined props.treeData !== undefined
? toRaw(props.treeData) ? toRaw(props.treeData).slice()
: convertTreeToData(toRaw(props.children)); : convertTreeToData(toRaw(props.children));
}, },
{ immediate: true, deep: true }, { immediate: true, deep: true },