primevue-mirror/components/paginator/JumpToPageDropdown.vue

37 lines
868 B
Vue
Raw Normal View History

2022-09-06 12:03:37 +00:00
<template>
2022-09-14 11:26:01 +00:00
<JTPDropdown :modelValue="page" :options="pageOptions" optionLabel="label" optionValue="value" @update:modelValue="onChange($event)" class="p-paginator-page-options" :disabled="disabled"></JTPDropdown>
2022-09-06 12:03:37 +00:00
</template>
<script>
import Dropdown from 'primevue/dropdown';
export default {
name: 'JumpToPageDropdown',
emits: ['page-change'],
props: {
page: Number,
pageCount: Number,
disabled: Boolean
},
methods: {
onChange(value) {
this.$emit('page-change', value);
}
},
computed: {
pageOptions() {
let opts = [];
2022-09-14 11:26:01 +00:00
for (let i = 0; i < this.pageCount; i++) {
opts.push({ label: String(i + 1), value: i });
2022-09-06 12:03:37 +00:00
}
2022-09-14 11:26:01 +00:00
2022-09-06 12:03:37 +00:00
return opts;
}
},
components: {
2022-09-14 11:26:01 +00:00
JTPDropdown: Dropdown
2022-09-06 12:03:37 +00:00
}
2022-09-14 11:26:01 +00:00
};
2022-09-06 12:03:37 +00:00
</script>