|
12 | 12 | /> |
13 | 13 | </div> |
14 | 14 | <div class="v3-pagination__pages"> |
15 | | - <div class="v3-pagination__pages-prev"> |
| 15 | + <div class="v3-pagination__pages-prev" @click="handlePrevPage"> |
16 | 16 | <V3Icon :type="'Left'" /> |
17 | 17 | </div> |
18 | | - <div class="v3-pagination__pages-item">1</div> |
19 | | - <div class="v3-pagination__pages-item">2</div> |
20 | | - <div class="v3-pagination__pages-item">3</div> |
21 | | - <div class="v3-pagination__pages-item">4</div> |
22 | | - <div class="v3-pagination__pages-item">5</div> |
23 | | - <div class="v3-pagination__pages-next"> |
| 18 | + <div class="v3-pagination__pages-first"></div> |
| 19 | + <div |
| 20 | + class="v3-pagination__pages-fast-backward" |
| 21 | + @mouseenter="isHoverFastBackward = true" |
| 22 | + @mouseleave="isHoverFastBackward = false" |
| 23 | + > |
| 24 | + <V3Icon v-if="!isHoverFastBackward" :type="'More'" /> |
| 25 | + <V3Icon v-else :type="'DoubleLeft'" /> |
| 26 | + </div> |
| 27 | + <div class="v3-pagination__pages-item" @click="handleTogglePage">1</div> |
| 28 | + <div |
| 29 | + class="v3-pagination__pages-fast-forward" |
| 30 | + @mouseenter="isHoverFastForward = true" |
| 31 | + @mouseleave="isHoverFastForward = false" |
| 32 | + > |
| 33 | + <V3Icon v-if="!isHoverFastForward" :type="'More'" /> |
| 34 | + <V3Icon v-else :type="'DoubleRight'" /> |
| 35 | + </div> |
| 36 | + <div class="v3-pagination__pages-last"></div> |
| 37 | + <div class="v3-pagination__pages-next" @click="handleNextPage"> |
24 | 38 | <V3Icon :type="'Right'" /> |
25 | 39 | </div> |
26 | 40 | </div> |
|
38 | 52 | </div> |
39 | 53 | </template> |
40 | 54 | <script lang="ts" setup> |
41 | | -import { ref } from 'vue'; |
| 55 | +import { computed, ref } from 'vue'; |
42 | 56 |
|
43 | 57 | import { V3Icon, V3Input, V3Select } from '@components/main'; |
44 | 58 | import { isNumber } from 'lodash-es'; |
@@ -83,14 +97,28 @@ const props = withDefaults(defineProps<IPaginationProps>(), { |
83 | 97 | * 跳至第n页 |
84 | 98 | */ |
85 | 99 | const customPage = ref(); |
86 | | -function handleInput(v: string) { |
87 | | - customPage.value = Number.parseInt(v.replace(/[^0-9]/g, '')) || ''; |
| 100 | +function handleInput(e: InputEvent) { |
| 101 | + const target = e.target as HTMLInputElement; |
| 102 | + let value = target.value; |
| 103 | + let valueToNumber = Number.parseInt(value.replace(/[^0-9]/g, '')); |
| 104 | + customPage.value = !isNaN(valueToNumber) ? `${valueToNumber}` : undefined; |
88 | 105 | } |
| 106 | +const computedCustomPage = computed(() => { |
| 107 | + return Number.parseInt(customPage.value); |
| 108 | +}); |
89 | 109 |
|
90 | 110 | /** |
91 | 111 | * n条/页 |
92 | 112 | */ |
93 | 113 | const customPageSize = ref(10); |
| 114 | +
|
| 115 | +const isHoverFastForward = ref(false); |
| 116 | +
|
| 117 | +const isHoverFastBackward = ref(false); |
| 118 | +
|
| 119 | +function handlePrevPage() {} |
| 120 | +function handleTogglePage() {} |
| 121 | +function handleNextPage() {} |
94 | 122 | </script> |
95 | 123 | <style lang="scss"> |
96 | 124 | @import './Pagination.scss'; |
|
0 commit comments