Skip to content

Commit b670cf1

Browse files
committed
feat!: support specifying the path of page number parameter, add list.pageNumberAt, remove list.pageNumberKey
1 parent fb72373 commit b670cf1

File tree

7 files changed

+156
-266
lines changed

7 files changed

+156
-266
lines changed

README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -345,14 +345,15 @@ const FormData = window.FormData
345345
```ts
346346
useAdmate({
347347
list: {
348+
// 页码的参数名称或路径,必填
349+
// 支持属性名,如 `'pageNo'`
350+
// 支持属性路径,如 `'page.pageNo'`
351+
pageNumberAt: undefined,
352+
348353
// 可以在这里提供筛选参数的默认值
349354
filter: {
350-
[list.pageNumberKey]: 1,
355+
'pageNumberAt 生成的页码参数名称': 1
351356
},
352-
353-
// 必填
354-
// 页码的参数名
355-
pageNumberKey: undefined,
356357
},
357358
})
358359
```

demo/useAdmateAdapter.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import {
77
toRefs,
88
watch,
99
} from 'vue'
10-
import useAdmate from 'admate'
11-
import type { Form, FormStatus, GetListTrigger } from 'admate'
10+
import useAdmate from '../src'
11+
import type { Form, FormStatus, GetListTrigger } from '../src'
1212
import type {
1313
FormInstance,
1414
FormItemInstance,
@@ -194,7 +194,7 @@ export default (
194194
},
195195
dataAt: 'data.records',
196196
totalAt: res => Number(res.data.total),
197-
pageNumberKey: 'pageNo',
197+
pageNumberAt: 'pageNo',
198198
},
199199
form: {
200200
dataAt: 'data',

index.html

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" href="/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>{{ NAME }} (Vue {{ VUE_VERSION }})</title>
8+
</head>
39

4-
<head>
5-
<meta charset="UTF-8" />
6-
<link rel="icon" href="/favicon.ico" />
7-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8-
<title>{{ NAME }} (Vue {{ VUE_VERSION }})</title>
9-
</head>
10-
11-
<body>
12-
<div id="app"></div>
13-
<script type="module" src="/demo/vue{{ VUE_VERSION }}/index.ts"></script>
14-
</body>
15-
10+
<body>
11+
<div id="app"></div>
12+
<script type="module" src="/demo/vue{{ VUE_VERSION }}/index.ts"></script>
13+
</body>
1614
</html>

0 commit comments

Comments
 (0)