This commit is contained in:
oneao committed 2026-10-08 22:38:34 +08:00
1 parent f572dce2f6
commit e99a9fb274
356 files changed
+28877 -1055

No files matched your search

@@ -0,0 +1,14 @@
<script setup lang="ts">
// 最基础:v-model:current 绑定当前页,total 提供总条数(pageSize 默认 10)
import { ref } from 'vue'
import { G3Pagination } from '@g3soft/ui'
const current = ref(1)
</script>
<template>
<div>
<G3Pagination v-model:current="current" :total="86" />
<p style="margin: 8px 0 0; font-size: 13px; color: #6b7280">当前第 {{ current }} 页</p>
</div>
</template>
@@ -0,0 +1,26 @@
<script setup lang="ts">
// hideOnSinglePage:只有一页时整块隐藏;change 事件同时给出当前页与每页条数
import { ref } from 'vue'
import { G3Pagination, G3Space, G3Switch } from '@g3soft/ui'
const total = ref(8)
const current = ref(1)
const onlyOne = ref(false)
</script>
<template>
<G3Space direction="vertical" :size="12" style="display: flex">
<G3Space :size="8" align="center">
<G3Switch v-model="onlyOne">只有一页(8 条)</G3Switch>
<span style="font-size: 13px; color: #6b7280">切到 86 条可以看完整分页</span>
</G3Space>
<G3Pagination
v-model:current="current"
:total="onlyOne ? 8 : 86"
hide-on-single-page
show-total
@change="(page: number, size: number) => (current = page)"
/>
</G3Space>
</template>
@@ -0,0 +1,14 @@
<script setup lang="ts">
// showQuickJumper:输入页码后回车跳转;非法/越界输入会被收敛到有效范围
import { ref } from 'vue'
import { G3Pagination, G3Space } from '@g3soft/ui'
const current = ref(5)
</script>
<template>
<G3Space direction="vertical" :size="12" style="display: flex">
<G3Pagination v-model:current="current" :total="500" show-quick-jumper />
<G3Pagination v-model:current="current" :total="500" show-quick-jumper show-total show-size-changer />
</G3Space>
</template>
@@ -0,0 +1,25 @@
<script setup lang="ts">
// showSizeChanger:每页条数下拉;pageSizeOptions 自定义选项,showSizeChange 单独通知
import { ref } from 'vue'
import { G3Pagination } from '@g3soft/ui'
const current = ref(1)
const pageSize = ref(20)
const lastEvent = ref('暂无')
</script>
<template>
<div>
<G3Pagination
v-model:current="current"
v-model:page-size="pageSize"
:total="286"
:page-size-options="[10, 20, 50, 100]"
show-size-changer
@show-size-change="(page: number, size: number) => (lastEvent = `切换每页 ${size} 条,当前第 ${page} 页`)"
/>
<p style="margin: 8px 0 0; font-size: 13px; color: #6b7280">
每页 {{ pageSize }} 条|{{ lastEvent }}
</p>
</div>
</template>
@@ -0,0 +1,20 @@
<script setup lang="ts">
// showTotal:显示总条数;#showTotal 插槽可拿到 { total, from, to } 自定义文案
import { ref } from 'vue'
import { G3Pagination } from '@g3soft/ui'
const current = ref(2)
const pageSize = ref(10)
</script>
<template>
<div style="display: flex; flex-direction: column; gap: 16px">
<G3Pagination v-model:current="current" :total="53" show-total />
<G3Pagination v-model:current="current" v-model:page-size="pageSize" :total="53" show-total show-size-changer>
<template #showTotal="{ total, from, to }">
第 {{ from }}-{{ to }} 条 / 共 {{ total }} 条
</template>
</G3Pagination>
</div>
</template>