From 8fd74db35d89bcc05fe67ae092a28b367eb08b3b Mon Sep 17 00:00:00 2001 From: castle Date: Mon, 27 Dec 2021 16:31:40 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=B8=AD=E6=AF=8F=E9=A1=B5=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E5=8F=98=E5=8C=96=E6=97=B6=E8=A7=A6=E5=8F=91limit=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/docs/zh-CN/components/page.md | 36 ++++++++++++++++++++++++++- src/module/page/index.vue | 4 +-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/example/docs/zh-CN/components/page.md b/example/docs/zh-CN/components/page.md index dcfd4231..b7432617 100644 --- a/example/docs/zh-CN/components/page.md +++ b/example/docs/zh-CN/components/page.md @@ -119,6 +119,39 @@ export default { } + + +::: + +::: title 每页数量切换事件(limit) +::: + +::: demo + + + + + ::: ::: title 完整分页 @@ -127,7 +160,8 @@ export default { ::: demo + ::: ::: title 每页数量切换事件(limit) @@ -242,6 +270,7 @@ export default { | showRefresh | 显示刷新按钮 | `false` | | showSkip | 显示跳转 | `false` | | pages | 显示切页按钮数量 | `10` | +| limits | 切换每页数量的选择项 | `[10,20,30,40,50]` | ::: @@ -253,6 +282,7 @@ export default { | 事件 | 描述 | 参数 | | ---- | -------- | --------------------- | | jump | 切换回调 | { current: 当前页面 } | +| limit | 每页数量变化 | 变化后的值 | ::: diff --git a/src/module/page/index.vue b/src/module/page/index.vue index 5edfc2bf..500bdd91 100644 --- a/src/module/page/index.vue +++ b/src/module/page/index.vue @@ -31,11 +31,7 @@ @@ -65,7 +61,8 @@ const props = withDefaults( showLimit?: boolean | string; showInput?: boolean | string; showRefresh?: boolean | string; - pages?: number + pages?: number, + limits?: number[] }>(), { limit: 10, @@ -76,9 +73,11 @@ const props = withDefaults( showLimit: true, showInput: false, showRefresh: false, - pages: 10 + pages: 10, + limits: () => [10, 20, 30, 40, 50] } ); +const limits = ref(props.limits); const pages = props.pages / 2 const inlimit = computed({ get() { return props.limit }, set(v: number) { emit('limit', v) } }) const maxPage = ref(Math.ceil(props.total / props.limit));