[Vuejs]-Vue.js and paginate

0👍

The problem is that within your paginate filter you are using this.items, which contains all of the items in your list, regardless of the other filters. The argument called list, passed to the filter, contains only the filtered and ordered values, and is what you want to paginate. So your filter would look like this:

paginate: function(list) {

        this.resultCount = list.length;

        if (this.currentPage >= this.totalPages) {
          this.currentPage = Math.max(0, this.totalPages - 1);
        }

        var index = this.currentPage * this.itemsPerPage;

        return list.slice(index, index + this.itemsPerPage);
    }

Leave a comment