We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
定义一个数组
tags:any[];
方法1:filter 删除并不留空位
this.tags = this.tags.filter(tag => tag !== removedTag);
方法2:splice 删除并不留空位
const index = this.tags.indexOf(removedTag, 0); if (index > -1) { this.tags.splice(index, 1); }
方法3:remove 删除并留空位,会有empty占位
const index = this.tags.indexOf(removedTag, 0); if (index > -1) { delete this.tags[index]; }
示例代码
How do I remove an array item in TypeScript?
There was an error while loading. Please reload this page.