Browse Source

Enable to paginate by shortcut keys

pull/341/head
Hironsan 5 years ago
parent
commit
5c7fff0f12
1 changed files with 8 additions and 2 deletions
  1. 10
      frontend/components/containers/annotation/Paginator.vue

10
frontend/components/containers/annotation/Paginator.vue

@ -4,19 +4,23 @@
{{ page }} of {{ total }}
</span>
<v-btn
v-shortkey.once="['arrowleft']"
text
:disabled="page===1"
fab
small
@shortkey="prevPage"
@click="prevPage"
>
<v-icon>mdi-chevron-left</v-icon>
</v-btn>
<v-btn
v-shortkey.once="['arrowright']"
text
:disabled="page===total"
fab
small
@shortkey="nextPage"
@click="nextPage"
>
<v-icon>mdi-chevron-right</v-icon>
@ -25,7 +29,9 @@
</template>
<script>
import Vue from 'vue'
import { mapState, mapActions, mapMutations } from 'vuex'
Vue.use(require('vue-shortkey'))
export default {
data() {
@ -79,10 +85,10 @@ export default {
...mapActions('documents', ['getDocumentList']),
...mapMutations('documents', ['setCurrent', 'updateSearchOptions']),
prevPage() {
this.page -= 1
this.page = Math.max(this.page - 1, 1)
},
nextPage() {
this.page += 1
this.page = Math.min(this.page + 1, this.total)
}
}
}

Loading…
Cancel
Save