From ec1534001d3fcd4fe602c559efcb706ccd911a4a Mon Sep 17 00:00:00 2001
From: gimmyhehe <975402925@qq.com>
Date: Thu, 11 Jan 2024 15:43:53 +0800
Subject: [PATCH] docs(sites): [grid] add custom pager in grid demo (#1288)
---
.../pager/pager-in-grid-composition-api.vue | 427 +++++++++++++++++
.../pc/app/grid/pager/pager-in-grid.spec.ts | 16 +
.../demos/pc/app/grid/pager/pager-in-grid.vue | 436 ++++++++++++++++++
.../demos/pc/app/grid/webdoc/grid-pager.js | 10 +
4 files changed, 889 insertions(+)
create mode 100644 examples/sites/demos/pc/app/grid/pager/pager-in-grid-composition-api.vue
create mode 100644 examples/sites/demos/pc/app/grid/pager/pager-in-grid.spec.ts
create mode 100644 examples/sites/demos/pc/app/grid/pager/pager-in-grid.vue
diff --git a/examples/sites/demos/pc/app/grid/pager/pager-in-grid-composition-api.vue b/examples/sites/demos/pc/app/grid/pager/pager-in-grid-composition-api.vue
new file mode 100644
index 000000000..b219feae1
--- /dev/null
+++ b/examples/sites/demos/pc/app/grid/pager/pager-in-grid-composition-api.vue
@@ -0,0 +1,427 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/sites/demos/pc/app/grid/pager/pager-in-grid.spec.ts b/examples/sites/demos/pc/app/grid/pager/pager-in-grid.spec.ts
new file mode 100644
index 000000000..06fa694a4
--- /dev/null
+++ b/examples/sites/demos/pc/app/grid/pager/pager-in-grid.spec.ts
@@ -0,0 +1,16 @@
+import { test, expect } from '@playwright/test'
+
+test('测试表格分页', async ({ page }) => {
+ page.on('pageerror', (exception) => expect(exception).toBeNull())
+ await page.goto('grid-pager#pager-in-grid')
+
+ const demo = page.locator('#pager-in-grid')
+ const pager = demo.locator('.tiny-pager')
+ const next = pager.locator('.tiny-pager__btn-next')
+ const firstTableRow = demo.locator('.tiny-grid .tiny-grid-body__row').first()
+
+ await next.click()
+ await expect(firstTableRow).toHaveText(/WSX科技YX公司/)
+ await next.click()
+ await expect(firstTableRow).toHaveText(/TIG管理YX公司/)
+})
diff --git a/examples/sites/demos/pc/app/grid/pager/pager-in-grid.vue b/examples/sites/demos/pc/app/grid/pager/pager-in-grid.vue
new file mode 100644
index 000000000..86e24ab44
--- /dev/null
+++ b/examples/sites/demos/pc/app/grid/pager/pager-in-grid.vue
@@ -0,0 +1,436 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/sites/demos/pc/app/grid/webdoc/grid-pager.js b/examples/sites/demos/pc/app/grid/webdoc/grid-pager.js
index 904982394..e431f28e3 100644
--- a/examples/sites/demos/pc/app/grid/webdoc/grid-pager.js
+++ b/examples/sites/demos/pc/app/grid/webdoc/grid-pager.js
@@ -39,6 +39,16 @@ export default {
'en-US': ''
},
'codeFiles': ['pager/show-save-msg.vue']
+ },
+ {
+ 'demoId': 'pager-in-grid',
+ 'name': { 'zh-CN': '自定义分页', 'en-US': '' },
+ 'desc': {
+ 'zh-CN':
+ '
表格内置分页组件需要和 fetch-data
属性配合使用,若使用 data
设置表格数据源,则需要使用自动义分页。
\n',
+ 'en-US': ''
+ },
+ 'codeFiles': ['pager/pager-in-grid.vue']
}
],
apis: [{ 'name': 'grid-pager', 'type': 'component', 'props': [], 'events': [], 'slots': [] }]