Merge pull request #1562 from rijn/1543

Fix #1543
This commit is contained in:
Aresn 2017-08-09 11:42:43 +08:00 committed by GitHub
commit 0da09e9a8c
2 changed files with 20 additions and 2 deletions

View file

@ -1,8 +1,20 @@
<template>
<Page :total="100" show-sizer show-elevator show-total></Page>
<div>
<Page :total="total" show-sizer show-elevator show-total></Page>
<Button type="primary" @click="subject">- 1</Button>
</div>
</template>
<script>
export default {
data () {
return {
total: 21
}
},
methods: {
subject() {
this.total -= 1;
}
}
}
</script>

View file

@ -135,6 +135,12 @@
};
},
watch: {
total (val) {
let maxPage = Math.ceil(val / this.currentPageSize);
if (maxPage < this.currentPage && maxPage > 0) {
this.currentPage = maxPage;
}
},
current (val) {
this.currentPage = val;
},