-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pagination: handle NaN on props #10623
Conversation
@@ -375,27 +375,30 @@ export default { | |||
pageSize: { | |||
immediate: true, | |||
handler(val) { | |||
this.internalPageSize = val; | |||
this.internalPageSize = isNaN(val) ? 10 : val; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I think it should be 1
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! I though it was 10
because pageSize
's default value is 10
as written on prop type definitions.
default: 10 |
Am I missing something? Sorry, I'm kind of new to this part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah you're right.
Merge commit 'e344b24efff83e35ed424f073e3141a3e7068595' into current * commit 'e344b24efff83e35ed424f073e3141a3e7068595': (60 commits) Changelog: fix a 2.3.4 typo (ElemeFE#10710) Changelog: update for 2.3.4 (ElemeFE#10703) [release] 2.3.4 [build] 2.3.4 Changelog: update for 2.3.4 (ElemeFE#10691) Rate: fix a method name typo (ElemeFE#10688) Types: add missing CheckboxButton export (ElemeFE#10666) Table: add $index as formatter's param (ElemeFE#10645) Tabs: fix text color for disabled border-card (ElemeFE#10640) Select: fix tags style in IE10 (ElemeFE#10632) Textarea: fix undefined in ssr when v-model not set (ElemeFE#10630) Pagination: disabled prev and next buttons should not trigger click (ElemeFE#10628) Pagination: handle NaN on props (ElemeFE#10623) Upload: fix duplicated handleClick due to keydown bubbling (ElemeFE#10624) Select: fix a wrong variable name (ElemeFE#10618) Table: update resizeState when updateColumnsWidth (ElemeFE#10338) Pagination: ensure currentPage is updated in current-change handler (ElemeFE#10599) i18n: fix a typo in pl.js (ElemeFE#10593) Radio: remove native input's offset of radio button (ElemeFE#10592) i18n: add ug-CN (ElemeFE#10585) ... # Conflicts: # CHANGELOG.zh-CN.md # examples/versions.json # package.json # src/index.js
Please make sure these boxes are checked before submitting your PR, thank you!
dev
branch.Pagination component breaks when
NaN
is passed on the propcurrentPage
orpageSize
. Here is a demo reproducing the issue.https://jsfiddle.net/xroupdkf/2/

I added a little protection code to keep it safe from
NaN
.NaN
,pageSize
returns default value (which is10
).currentPage
already had a nice handling code insideinternalCurrentPage
watcher but it is not invoked at initial phase, so I made it to be called immediately.It passes all of the test cases and I added more of it.
Thank you for maintaining this amazing repository.