Skip to content

Commit 022996b

Browse files
committed
fix(b-pagination): properly calculate number of links with hide-ellipsis option
1 parent 31c06b5 commit 022996b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/mixins/pagination.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,14 @@ export default {
223223
},
224224
paginationParams() {
225225
// Determine if we should show the the ellipsis
226-
const limit = this.localLimit
227-
const numberOfPages = this.localNumberOfPages
228-
const currentPage = this.computedCurrentPage
229-
const hideEllipsis = this.hideEllipsis
230-
const firstNumber = this.firstNumber
231-
const lastNumber = this.lastNumber
226+
const {
227+
localLimit: limit,
228+
localNumberOfPages: numberOfPages,
229+
computedCurrentPage: currentPage,
230+
hideEllipsis,
231+
firstNumber,
232+
lastNumber
233+
} = this
232234
let showFirstDots = false
233235
let showLastDots = false
234236
let numberOfLinks = limit
@@ -252,7 +254,7 @@ export default {
252254
} else {
253255
// We are somewhere in the middle of the page list
254256
if (limit > ELLIPSIS_THRESHOLD) {
255-
numberOfLinks = limit - 2
257+
numberOfLinks = limit - (hideEllipsis ? 0 : 2)
256258
showFirstDots = !!(!hideEllipsis || firstNumber)
257259
showLastDots = !!(!hideEllipsis || lastNumber)
258260
}

0 commit comments

Comments
 (0)