primevue-mirror/components/paginator/JumpToPageInput.vue

42 lines
990 B
Vue
Raw Normal View History

2022-09-06 12:03:37 +00:00
<template>
2023-01-10 07:57:30 +00:00
<JTPInput ref="jtpInput" v-model="inputVal" class="p-paginator-page-input" :aria-label="inputArialabel" :disabled="disabled"></JTPInput>
2022-09-06 12:03:37 +00:00
</template>
<script>
import InputNumber from 'primevue/inputnumber';
export default {
name: 'JumpToPageInput',
inheritAttrs: false,
emits: ['page-change'],
props: {
page: Number,
pageCount: Number,
disabled: Boolean
},
2023-01-10 07:57:30 +00:00
data() {
return {
inputVal: null
};
},
watch: {
inputVal(newValue) {
if (this.$refs.jtpInput && !this.$refs.jtpInput.focused) return;
this.$emit('page-change', newValue - 1);
2022-09-06 12:03:37 +00:00
}
},
2023-01-10 07:57:30 +00:00
mounted() {
this.inputVal = this.page;
},
2022-12-08 11:04:25 +00:00
computed: {
inputArialabel() {
return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.jumpToPageInputLabel : undefined;
}
},
2022-09-06 12:03:37 +00:00
components: {
2022-09-14 11:26:01 +00:00
JTPInput: InputNumber
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>