削除後にelテーブルが更新されない場合のデータ表示を削除する方法

1.el-tableで、行だけを削除する

<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.方法

const delete = function(index: number,row:any) {
			this.$prompt('确定删除?', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消'
			}).then(({ value }) => {

					//执行删除方法
                    //...........
                this.tabledata.splice(index, 1)
					
			}).catch(() => {
					this.$message({
						type: 'info',
						message: '取消输入'
					});
			});
		}

これにより、実際にデータを削除する場合に、クエリを更新したり再呼び出ししたりすることなく、タイムリーにデータを削除できます。

おすすめ

転載: blog.csdn.net/guapilixianghe/article/details/126917316
おすすめ