我有从数据库连接到vueJS的内联表。计划是复制其中一行。行已成功地与this.array.push (... ...)复制。
但是,当我想以这个ar.array.splice (index (from row), 1)的方式删除它时,被删除的是顶部或底部,而不是被单击的索引中的行。
代码:
public duplicate(){
this.countries.push({
name: this.multipleSelection[0].name,
code: this.multipleSelection[0].code,
currencyId: this.multipleSelection[0].currencyId,
currencyName: this.multipleSelection[0].currencyName,
duplicate: true
})
}
public cancelDuplicate(item, index){
this.countries.splice(index, 1)
console.log(index)
}发布于 2020-05-06 05:06:41
您可以使用findIndex来拼接arr。
this.countries.splice(this.countries.findIndex(e => e ===指数),1)
https://stackoverflow.com/questions/61627432
复制相似问题