Commit 6d2b7bcbc935f8b9a5d216a8c983fcd4a73aebc6
1 parent
8869b70d
fixed #1575
Showing
2 changed files
with
4 additions
and
3 deletions
Show diff stats
examples/routers/page.vue
| @@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
| 4 | {{ current }} | 4 | {{ current }} |
| 5 | <Button type="primary" @click="subject">- 1</Button> | 5 | <Button type="primary" @click="subject">- 1</Button> |
| 6 | <Button type="primary" @click="change">Change</Button> | 6 | <Button type="primary" @click="change">Change</Button> |
| 7 | + <Page :current="2" :total="50" simple></Page> | ||
| 7 | </div> | 8 | </div> |
| 8 | </template> | 9 | </template> |
| 9 | <script> | 10 | <script> |
src/components/page/page.vue
| @@ -260,7 +260,7 @@ | @@ -260,7 +260,7 @@ | ||
| 260 | }, | 260 | }, |
| 261 | keyDown (e) { | 261 | keyDown (e) { |
| 262 | const key = e.keyCode; | 262 | const key = e.keyCode; |
| 263 | - const condition = (key >= 48 && key <= 57) || (key >= 96 && key <= 105) || key == 8 || key == 37 || key == 39; | 263 | + const condition = (key >= 48 && key <= 57) || (key >= 96 && key <= 105) || key === 8 || key === 37 || key === 39; |
| 264 | 264 | ||
| 265 | if (!condition) { | 265 | if (!condition) { |
| 266 | e.preventDefault(); | 266 | e.preventDefault(); |
| @@ -274,12 +274,12 @@ | @@ -274,12 +274,12 @@ | ||
| 274 | this.prev(); | 274 | this.prev(); |
| 275 | } else if (key === 40) { | 275 | } else if (key === 40) { |
| 276 | this.next(); | 276 | this.next(); |
| 277 | - } else if (key == 13) { | 277 | + } else if (key === 13) { |
| 278 | let page = 1; | 278 | let page = 1; |
| 279 | 279 | ||
| 280 | if (val > this.allPages) { | 280 | if (val > this.allPages) { |
| 281 | page = this.allPages; | 281 | page = this.allPages; |
| 282 | - } else if (val <= 0) { | 282 | + } else if (val <= 0 || !val) { |
| 283 | page = 1; | 283 | page = 1; |
| 284 | } else { | 284 | } else { |
| 285 | page = val; | 285 | page = val; |