Selaa lähdekoodia

调整数据类型

wangxy 2 kuukautta sitten
vanhempi
commit
87955d6c4a
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      utils/common.js

+ 2 - 2
utils/common.js

@@ -138,7 +138,7 @@ export function findRootNode(tree, targetId, idKey = 'id') {
 	const path = [];
 
 	function traverse(node) {
-		if (node[idKey] === targetId) return true;
+		if (node[idKey] == targetId) return true;
 		if (node.children) {
 			for (const child of node.children) {
 				if (traverse(child)) {
@@ -161,7 +161,7 @@ export function findRootNode(tree, targetId, idKey = 'id') {
 
 export function findTreeNode(tree, targetId, childrenKey = 'children', idKey = 'id') {
 	for (const node of tree) {
-		if (node[idKey] === targetId) return node;
+		if (node[idKey] == targetId) return node;
 		if (node[childrenKey]?.length) {
 			const found = findTreeNode(node[childrenKey], targetId, childrenKey, idKey);
 			if (found) return found;