this.network.nodeList.forEach((node) => { //過濾出符合條件的節點 let people:any = this.peopleList.filter((item) => item.name ===node.name); node.relation = people[0].relation; });
people是一個array,只包含一個對象,因此在獲取的時候須要使用index=0,不然直接使用會undefinednode