-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
Pagination.vue
39 lines (36 loc) · 902 Bytes
/
Pagination.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<template>
<div class="absolute p-2 text-xs" :class="classNames"><SlideCurrentNo /> / <SlidesTotal /></div>
</template>
<script setup lang="ts">
import { computed, PropType } from 'vue';
const {
classNames: classNamesTransferred,
x,
y,
} = defineProps({
classNames: {
type: [Array, String] as PropType<string[] | string>,
},
x: {
default: 'r',
type: String as PropType<'l' | 'r'>,
validator: (value) => value === 'l' || value === 'r',
},
y: {
default: 't',
type: String as PropType<'b' | 't'>,
validator: (value) => value === 'b' || value === 't',
},
});
const classNames = computed(() => [
...(classNamesTransferred
? Array.isArray(classNamesTransferred)
? classNamesTransferred
: [classNamesTransferred]
: []),
x === 'l' && 'left-0',
x === 'r' && 'right-0',
y === 't' && 'top-0',
y === 'b' && 'bottom-0',
]);
</script>