Skip to content

Commit 5c7fff0

Browse files
committed
Enable to paginate by shortcut keys
1 parent d1ceed5 commit 5c7fff0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

frontend/components/containers/annotation/Paginator.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,23 @@
44
{{ page }} of {{ total }}
55
</span>
66
<v-btn
7+
v-shortkey.once="['arrowleft']"
78
text
89
:disabled="page===1"
910
fab
1011
small
12+
@shortkey="prevPage"
1113
@click="prevPage"
1214
>
1315
<v-icon>mdi-chevron-left</v-icon>
1416
</v-btn>
1517
<v-btn
18+
v-shortkey.once="['arrowright']"
1619
text
1720
:disabled="page===total"
1821
fab
1922
small
23+
@shortkey="nextPage"
2024
@click="nextPage"
2125
>
2226
<v-icon>mdi-chevron-right</v-icon>
@@ -25,7 +29,9 @@
2529
</template>
2630

2731
<script>
32+
import Vue from 'vue'
2833
import { mapState, mapActions, mapMutations } from 'vuex'
34+
Vue.use(require('vue-shortkey'))
2935
3036
export default {
3137
data() {
@@ -79,10 +85,10 @@ export default {
7985
...mapActions('documents', ['getDocumentList']),
8086
...mapMutations('documents', ['setCurrent', 'updateSearchOptions']),
8187
prevPage() {
82-
this.page -= 1
88+
this.page = Math.max(this.page - 1, 1)
8389
},
8490
nextPage() {
85-
this.page += 1
91+
this.page = Math.min(this.page + 1, this.total)
8692
}
8793
}
8894
}

0 commit comments

Comments
 (0)