const deleteRow = (asyncDeleteMethod, message) => {
if (asyncDeleteMethod && typeof asyncDeleteMethod === 'function') {
ElMessageBox.confirm(message || '确定执行删除操作吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
asyncDeleteMethod().then(() => {
ElMessage({
grouping: true,
showClose: true,
type: 'success',
message: '数据删除成功!'
})
// 当前页非第一页且只有1条数据,但被执行了删除
if (state.tableData.length === 1 && state.currentPage > 1) {
state.currentPage--
}
getTableData()
})
})
.catch(() => {})
} else {
console.warn('请传入删除的异步函数')
}
}
vue表格分页、当前页非第一页且只有一条数据但被执行了删除
于 2022-08-18 23:31:26 首次发布