lokyoung / vuejs-paginate

A Vue.js(v2.x+) component for creating pagination.
MIT License
779 stars 171 forks source link

Using paginate control twice on a page, doesn't sync #90

Closed craiggeil closed 5 years ago

craiggeil commented 5 years ago

I wanted to use the control at the top and bottom of a grid control. However I wanted them to stay in sync. If I went to page 3 at the top control, I wanted the bottom control to also display page 3 as being selected. The forcePage property doesn't really work when you are using it in the beforeUpdate call. I had to revise your code and add a watcher on it like this --

watch: { forcePage: function (n,o) { if (o != n && this.selected != (n-1)) { this.selected = n - 1; } }, },

lokyoung commented 5 years ago

Hi @craiggeil . You can just use v-model to keep them sync. https://github.com/lokyoung/vuejs-paginate#value-binding

craiggeil commented 5 years ago

Thanks! That works