Merge branch 'dev' into order-delivery-reply
# Conflicts: # frontend/src/locales/en/admin.json # frontend/src/locales/th/admin.json # frontend/src/locales/zh-TW/admin.json
This commit is contained in:
commit
7fb36b301c
13 files changed
+285
-99
No files matched your search
@@ -2,12 +2,13 @@
|
||||
/**
|
||||
* shared/components/PaginationBar.vue
|
||||
* 用途:通用偏移分页条(摘要、每页条数、页码按钮)。
|
||||
* 依赖:buildOffsetPageButtons、common.pagination i18n、components-ds 样式类。
|
||||
* 依赖:buildOffsetPageButtons、common.pagination i18n、components-ds 样式类、lucide-vue-next。
|
||||
* 逻辑:父组件 v-model:page / v-model:page-size,服务端或客户端分页均可复用。
|
||||
* 每页条数用自定义 SVG 箭头,并隐藏系统原生/::picker-icon,避免 Windows 下双箭头。
|
||||
* 每页条数下拉选项文案为「{size} 条/页」一体展示;上一页/下一页用 Chevron,文案仅作 aria-label。
|
||||
*/
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ChevronLeft, ChevronRight } from 'lucide-vue-next';
|
||||
import { buildOffsetPageButtons } from '@/shared/composables/useOffsetPagination';
|
||||
|
||||
interface Props {
|
||||
@@ -94,40 +95,40 @@ const onPageSizeChange = (size: number): void => {
|
||||
{{ t('common.pagination.summary', { total, page: safePage, pages: totalPages }) }}
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<label class="flex items-center gap-2 text-xs text-secondary">
|
||||
<span>{{ t('common.pagination.perPage') }}</span>
|
||||
<span class="pagination-page-size relative inline-flex items-center">
|
||||
<select
|
||||
:value="pageSize"
|
||||
class="admin-table-filter-input appearance-none bg-none pl-2 pr-7 py-1 text-xs leading-5"
|
||||
@change="onPageSizeChange(Number(($event.target as HTMLSelectElement).value))"
|
||||
>
|
||||
<option v-for="size in pageSizeOptions" :key="`page-size-${size}`" :value="size">
|
||||
{{ size }}
|
||||
</option>
|
||||
</select>
|
||||
<svg
|
||||
class="pointer-events-none absolute right-2 h-3.5 w-3.5 text-muted"
|
||||
viewBox="0 0 20 20"
|
||||
fill="currentColor"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
d="M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.168l3.71-3.938a.75.75 0 1 1 1.08 1.04l-4.25 4.5a.75.75 0 0 1-1.08 0l-4.25-4.5a.75.75 0 0 1 .02-1.06Z"
|
||||
clip-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
<span>{{ t('common.pagination.itemsUnit') }}</span>
|
||||
<label class="pagination-page-size relative inline-flex items-center text-xs text-secondary">
|
||||
<span class="sr-only">{{ t('common.pagination.perPage') }}</span>
|
||||
<select
|
||||
:value="pageSize"
|
||||
class="admin-table-filter-input appearance-none bg-none pl-2.5 pr-7 py-1 text-xs leading-5"
|
||||
:aria-label="t('common.pagination.perPage')"
|
||||
@change="onPageSizeChange(Number(($event.target as HTMLSelectElement).value))"
|
||||
>
|
||||
<option v-for="size in pageSizeOptions" :key="`page-size-${size}`" :value="size">
|
||||
{{ t('common.pagination.pageSizeLabel', { size }) }}
|
||||
</option>
|
||||
</select>
|
||||
<svg
|
||||
class="pointer-events-none absolute right-2 h-3.5 w-3.5 text-muted"
|
||||
viewBox="0 0 20 20"
|
||||
fill="currentColor"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
d="M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.168l3.71-3.938a.75.75 0 1 1 1.08 1.04l-4.25 4.5a.75.75 0 0 1-1.08 0l-4.25-4.5a.75.75 0 0 1 .02-1.06Z"
|
||||
clip-rule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
:disabled="safePage <= 1"
|
||||
class="admin-report-page-btn"
|
||||
class="admin-report-page-btn pagination-nav-btn"
|
||||
:aria-label="t('common.pagination.prevPage')"
|
||||
:title="t('common.pagination.prevPage')"
|
||||
@click="onPrevPage"
|
||||
>
|
||||
{{ t('common.pagination.prevPage') }}
|
||||
<ChevronLeft class="h-4 w-4" aria-hidden="true" />
|
||||
</button>
|
||||
<button
|
||||
v-for="btn in pageButtons"
|
||||
@@ -147,10 +148,12 @@ const onPageSizeChange = (size: number): void => {
|
||||
<button
|
||||
type="button"
|
||||
:disabled="safePage >= totalPages"
|
||||
class="admin-report-page-btn"
|
||||
class="admin-report-page-btn pagination-nav-btn"
|
||||
:aria-label="t('common.pagination.nextPage')"
|
||||
:title="t('common.pagination.nextPage')"
|
||||
@click="onNextPage"
|
||||
>
|
||||
{{ t('common.pagination.nextPage') }}
|
||||
<ChevronRight class="h-4 w-4" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -176,4 +179,14 @@ const onPageSizeChange = (size: number): void => {
|
||||
display: none;
|
||||
content: none;
|
||||
}
|
||||
|
||||
/** 上一页/下一页改为图标按钮:固定方形点击区,与页码按钮对齐。 */
|
||||
.pagination-nav-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 2rem;
|
||||
padding-left: 0.35rem;
|
||||
padding-right: 0.35rem;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user