element-ui table表格删除最后一页的数据,返回上一页

发布时间 2023-08-04 16:13:43作者: 码梦为生℡
delete(item){
        this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$post(url).then((data) => {
            if (data.code === 200) {
              this.$message({
                type: 'success',
                message: '删除成功!'
              });
              let totalPage = Math.ceil((this.total - 1) / this.pageSize);
              let current = this.currentPage > totalPage ? totalPage : this.currentPage;
              this.currentPage = current < 1 ? 1 : current;
         //请求
this.search(); }else{ this.$message({ type: 'success', message: '删除失败!' }); } }); }).catch(() => { this.$message({ type: 'info', message: '已取消删除' }); }); },