This commit is contained in:
梁灏 2017-11-07 17:07:03 +08:00
parent 8869b70d0b
commit 6d2b7bcbc9
2 changed files with 4 additions and 3 deletions

View file

@ -4,6 +4,7 @@
{{ current }} {{ current }}
<Button type="primary" @click="subject">- 1</Button> <Button type="primary" @click="subject">- 1</Button>
<Button type="primary" @click="change">Change</Button> <Button type="primary" @click="change">Change</Button>
<Page :current="2" :total="50" simple></Page>
</div> </div>
</template> </template>
<script> <script>

View file

@ -260,7 +260,7 @@
}, },
keyDown (e) { keyDown (e) {
const key = e.keyCode; const key = e.keyCode;
const condition = (key >= 48 && key <= 57) || (key >= 96 && key <= 105) || key == 8 || key == 37 || key == 39; const condition = (key >= 48 && key <= 57) || (key >= 96 && key <= 105) || key === 8 || key === 37 || key === 39;
if (!condition) { if (!condition) {
e.preventDefault(); e.preventDefault();
@ -274,12 +274,12 @@
this.prev(); this.prev();
} else if (key === 40) { } else if (key === 40) {
this.next(); this.next();
} else if (key == 13) { } else if (key === 13) {
let page = 1; let page = 1;
if (val > this.allPages) { if (val > this.allPages) {
page = this.allPages; page = this.allPages;
} else if (val <= 0) { } else if (val <= 0 || !val) {
page = 1; page = 1;
} else { } else {
page = val; page = val;