ES6快速删除数组中的某条数据

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_34664239/article/details/88949506
//这是vue methods中的一个方法
deleteCarEvent(carID){
    const _this = this;
    console.log('要删除的carID为:' + carID)
    deleteCar(carID).then(function(resolve){
        console.log(resolve)
        //ES6快速删除某条元素的方法
        _this.carList.splice( _this.carList.findIndex(item => item.carID === carID), 1)
    }, reject => {
        Toast('删除失败');
    })
},

猜你喜欢

转载自blog.csdn.net/qq_34664239/article/details/88949506