iter: b04 新增独立 pagination 分页器并与 dataTable 页码联动
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
form,
|
||||
formItem,
|
||||
modal,
|
||||
pagination,
|
||||
progress,
|
||||
radioGroup,
|
||||
select,
|
||||
@@ -67,6 +68,9 @@ const username = signal('');
|
||||
const email = signal('');
|
||||
const formResult = signal('');
|
||||
|
||||
// —— 分页联动状态:dataTable 与独立 pagination 共用同一页码信号 ——
|
||||
const tablePage = signal(1);
|
||||
|
||||
const app = h(
|
||||
'div',
|
||||
{ class: 'page' },
|
||||
@@ -190,6 +194,19 @@ const app = h(
|
||||
],
|
||||
pageSize: 5,
|
||||
})),
|
||||
card(
|
||||
{ title: '独立分页器联动(pageSize 3,共用页码信号)' },
|
||||
dataTable({
|
||||
data: users,
|
||||
columns: [
|
||||
{ key: 'name', header: '姓名' },
|
||||
{ key: 'city', header: '城市' },
|
||||
],
|
||||
pageSize: 3,
|
||||
page: tablePage,
|
||||
}),
|
||||
pagination({ page: tablePage, pageSize: 3, total: users.length, onChange: (p) => tablePage(p) }),
|
||||
),
|
||||
),
|
||||
section(
|
||||
'sec-card',
|
||||
|
||||
Reference in New Issue
Block a user