iview删除一条数据后,不重置到第一页的办法

    /***
     * @desc 删除内容后重置当前页
     * @param 无
     * @return 无
     */
    resetCurrentPage() {
      let resetTotal = this.pageInfo.totalCount - this.selectedRowsId.length;
      let currentPage =
        this.pageInfo.currentPage === 1 ? 1 : this.pageInfo.currentPage - 1;
      let tmpTotal = currentPage * this.pageInfo.pageSize;
      if (tmpTotal < resetTotal && this.pageInfo.currentPage !== 1) {
        this.pageInfo.currentPage = currentPage += 1;
      } else {
        this.pageInfo.currentPage = currentPage;
      }
    },

例如,总数据数21条,每页10条,一共三页,删除第21条记录后,当前页应该为第二页,每次查询后默认为1

你可能感兴趣的:(前端iview)