Sir*_*nce 2 javascript vue.js bootstrap-vue
我在我的应用程序中添加了一个 Bootstrap Vue 表,并希望在用户使用内置分页切换到另一个页面时进行记录。
https://bootstrap-vue.js.org/docs/components/table/
为此,我添加了一个@change
应该监听和记录分页的 v 模型的currentPage
. 但是,它似乎是在currentPage
实际更新之前调用的。
我如何才能正确收听此更新?
这是我尝试过的:https : //jsfiddle.net/eywraw8t/394424/
new Vue({
el: "#app",
data: {
totalRows: 50,
perPage: 10,
currentPage: 1
},
methods: {
pagination() {
console.log(this.currentPage);
},
}
})
Run Code Online (Sandbox Code Playgroud)
<div id="app">
<div>
<b-pagination :total-rows="totalRows" :per-page="perPage" v-model="currentPage" @change="pagination" />
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
你可以看 currentPage
new Vue({
el: "#app",
data: {
totalRows: 50,
perPage: 10,
currentPage: 1
},
watch: {
currentPage: function (newVal) {
console.log('Change to page', newVal)
}
},
methods: {
setTo() {
this.currentPage = 1;
console.log(this.currentPage);
}
}
})
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4875 次 |
最近记录: |