方法大同小异
都是遍历后找出index
再通过splice来删除
简便方法是利用map
removeItem(val: string) {
this.items.map((v, i) => {
if (v === val) {
this.items.splice(i, 1);
}
});
}
方法大同小异
都是遍历后找出index
再通过splice来删除
简便方法是利用map
removeItem(val: string) {
this.items.map((v, i) => {
if (v === val) {
this.items.splice(i, 1);
}
});
}