refactor property names to make more sense #517 (#521)

* Added watchers on mdTotal and mdPage. Changed the binding for the disabled attribute of the next page arrow to use a computed property. Fix issue #482.

* Improve code readability for the fix done for #482.
This commit is contained in:
Praneet Loke 2017-02-16 10:53:09 -08:00 committed by Marcos Moura
parent cde4710cf0
commit b380dcfca6

View file

@ -12,7 +12,7 @@
<md-icon>keyboard_arrow_left</md-icon>
</md-button>
<md-button class="md-icon-button md-table-pagination-next" @click.native="nextPage" :disabled="hasMoreItems">
<md-button class="md-icon-button md-table-pagination-next" @click.native="nextPage" :disabled="shouldDisable">
<md-icon>keyboard_arrow_right</md-icon>
</md-button>
</div>
@ -56,17 +56,17 @@
this.totalItems = isNaN(val) ? Number.MAX_SAFE_INTEGER : parseInt(val, 10);
},
mdSize(val) {
this.currentSize = parseInt(this.mdSize, 10);
this.currentSize = parseInt(val, 10);
},
mdPage(val) {
this.currentPage = parseInt(this.mdPage, 10);
this.currentPage = parseInt(val, 10);
}
},
computed: {
lastPage() {
return false;
},
hasMoreItems() {
shouldDisable() {
return this.currentSize * this.currentPage >= this.totalItems;
}
},