fix(pagination): fix pagination known issues (#811)

* fix(pagination): fix pagination known issues

- Fix pagination emitting current change twice

* fix(pagination): add defaults for readability

* fix(pagination): - remove defaults
This commit is contained in:
jeremywu 2020-12-05 22:14:38 +08:00 committed by GitHub
parent ab76b845f5
commit 6bc5a5ee5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 6 deletions

View File

@ -72,6 +72,7 @@ describe('Pagination.vue', () => {
props: {
pageSize: 25,
pagerCount: 5,
pageCount: 50,
},
})
expect(wrapper.findAll('li.number').length).toBe(5)

View File

@ -39,12 +39,10 @@ export default defineComponent({
total: {
type: Number,
default: 1000,
},
pageCount: {
type: Number,
default: 50,
},
pagerCount: {
@ -124,9 +122,8 @@ export default defineComponent({
nextTick(() => {
if (
internalCurrentPage.value !== lastEmittedPage.value ||
userChangePageSize
userChangePageSize.value
) {
emit('current-change', internalCurrentPage.value)
lastEmittedPage.value = internalCurrentPage.value
userChangePageSize.value = false
}
@ -136,7 +133,6 @@ export default defineComponent({
function handleCurrentChange(val: number) {
internalCurrentPage.value = getValidCurrentPage(val)
userChangePageSize.value = true
emitChange()
}
function handleSizesChange(val: number) {

View File

@ -57,7 +57,6 @@ export default defineComponent({
},
pageCount: {
type: Number,
default: 50,
},
pagerCount: {
type: Number,