有没有办法以编程方式更改Bootstrap-Vue中的b-pagination,就像这样:
或者使用类似这样的分页插件:
this.$refs.pagination.goToPage(3) // This is just example
或者使用类似这样的分页插件:
this.$bvPagination.goToPage('pagination', 3) // This is just example too
我正在尝试寻找 bootstrap-vue 分页插件 的文档,但是我还没有找到。我以为会有像 模态框插件 中的 $bvModal 一样的东西,比如 $bvPagination。
使用 v-model 对我来说没有起作用,页面仍然停留在第一页。
<b-pagination
v-model="pagination.currentPage"
:total-rows="pagination.totalItems"
first-number
last-number
:per-page="pagination.selectedAmount"
/>
在mounted方法中:
mounted() {
this.pagination.currentPage = this.$store.state.app.lastPage
}
在观察中:
watch: {
'pagination.currentPage': function (page) {
this.$store.commit('app/UPDATE_LAST_PAGE', page)
},
},