1. In el-table, delete a row alone
<el-table-column " label="操作" min-width="30">
<template #default="scope">
<el-button @click.prevent="delete(scope.$index,scope.row)" type="danger" size="small" > 删除</el-button>
</template>
</el-table-column>
2. Method
const delete = function(index: number,row:any) {
this.$prompt('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(({ value }) => {
//执行删除方法
//...........
this.tabledata.splice(index, 1)
}).catch(() => {
this.$message({
type: 'info',
message: '取消输入'
});
});
}
This enables timely deletion of data in the event that you actually delete the data, and without refreshing or re-invoking the query.