js删除
let a = ['222','333'];
let index = a.indexOf('333');
if(index!=-1)
a.splice(index,1);
复制代码
结果:["222"]
vue删除
this.a = ['222','333'];
this.a.$remove('222');
复制代码
结果:["333"]
let a = ['222','333'];
let index = a.indexOf('333');
if(index!=-1)
a.splice(index,1);
复制代码
结果:["222"]
this.a = ['222','333'];
this.a.$remove('222');
复制代码
结果:["333"]
转载于:https://juejin.im/post/5c496a32f265da6147708b91