Commit 6d2b7bcbc935f8b9a5d216a8c983fcd4a73aebc6

Authored by 梁灏
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 4 {{ current }}
5 5 <Button type="primary" @click="subject">- 1</Button>
6 6 <Button type="primary" @click="change">Change</Button>
  7 + <Page :current="2" :total="50" simple></Page>
7 8 </div>
8 9 </template>
9 10 <script>
... ...
src/components/page/page.vue
... ... @@ -260,7 +260,7 @@
260 260 },
261 261 keyDown (e) {
262 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 265 if (!condition) {
266 266 e.preventDefault();
... ... @@ -274,12 +274,12 @@
274 274 this.prev();
275 275 } else if (key === 40) {
276 276 this.next();
277   - } else if (key == 13) {
  277 + } else if (key === 13) {
278 278 let page = 1;
279 279  
280 280 if (val > this.allPages) {
281 281 page = this.allPages;
282   - } else if (val <= 0) {
  282 + } else if (val <= 0 || !val) {
283 283 page = 1;
284 284 } else {
285 285 page = val;
... ...