使用过滤器!!!!!
this.project = this.project.filter(item => item.id !== project.id);
或者使用splice(需要遍历,很麻烦!!)
例如:
for (let i = 0; i < element.project.length; i++) {
if (project.name === element.project[i].name) {
element.project.splice(i, 1);
}
}
等同于 element.project = element.project.filter(item => item.name !== project.name);