primevue-mirror/components/paginator/PageLinks.vue

45 lines
1.2 KiB
Vue
Raw Normal View History

2022-09-06 12:03:37 +00:00
<template>
<span class="p-paginator-pages">
2022-12-08 11:04:25 +00:00
<button
v-for="pageLink of value"
:key="pageLink"
v-ripple
:class="['p-paginator-page p-paginator-element p-link', { 'p-highlight': pageLink - 1 === page }]"
type="button"
:aria-label="ariaPageLabel(pageLink)"
:aria-current="pageLink - 1 === page ? 'page' : undefined"
@click="onPageLinkClick($event, pageLink)"
>
{{ pageLink }}
</button>
2022-09-06 12:03:37 +00:00
</span>
</template>
<script>
import Ripple from 'primevue/ripple';
export default {
name: 'PageLinks',
inheritAttrs: false,
emits: ['click'],
props: {
value: Array,
page: Number
},
methods: {
onPageLinkClick(event, pageLink) {
this.$emit('click', {
originalEvent: event,
value: pageLink
});
2022-12-08 11:04:25 +00:00
},
ariaPageLabel(value) {
return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.pageLabel.replace(/{page}/g, value) : undefined;
2022-09-06 12:03:37 +00:00
}
},
2022-12-08 11:04:25 +00:00
computed: {},
2022-09-06 12:03:37 +00:00
directives: {
2022-09-14 11:26:01 +00:00
ripple: Ripple
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>