Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[t-table] 切换分页,数据重复 #4746

Closed
JinPing5306 opened this issue Nov 18, 2024 · 9 comments
Closed

[t-table] 切换分页,数据重复 #4746

JinPing5306 opened this issue Nov 18, 2024 · 9 comments
Labels
usage the issue about component usage

Comments

@JinPing5306
Copy link

tdesign-vue-next 版本

1.10.3

重现链接

No response

重现步骤

image
第一页切换到下一页,数据重复;

期望结果

No response

实际结果

No response

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

No response

Copy link
Contributor

👋 @JinPing5306,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@JinPing5306
Copy link
Author

<t-table
bordered
:pagination
:loading="tableLoading"
row-key="jqdxbs"
:data="tableData"
:columns="tableColumns"
@change="tableChange"
:disableDataPage="true"
>

  const pagination = reactive({
    defaultCurrent: 1,
    defaultPageSize: 20,
    total: 0,
 });
 
 function tableChange(e) {
    pagination.defaultCurrent = e.pagination.current;
    pagination.defaultPageSize = e.pagination.pageSize;
     seachListFucn();

}

@uyarn
Copy link
Collaborator

uyarn commented Nov 18, 2024

tableColumns tableData 这两个字段提供一下

@JinPing5306
Copy link
Author

tableColumns tableData 这两个字段提供一下
const tableColumns = ref([
{ colKey: 'serial-number', title: '序号', align: 'center', ellipsis: true },
{ colKey: 'asjfskssj', title: '事发时间', align: 'center', width: '220' },
{ colKey: 'sacs_dzmc', title: '事发地点', align: 'center', ellipsis: true },
{ colKey: 'pcsmc', title: '所属派出所', align: 'center', ellipsis: true },
{ colKey: 'jflb', title: '纠纷类别', align: 'center', ellipsis: true },
{
colKey: 'ay',
title: '纠纷内容',
align: 'center',
ellipsis: true,
},
{ colKey: 'rs', title: '涉及人数', align: 'center' },
{ colKey: 'xm', title: '姓名', align: 'center' },
{ colKey: 'sfzh', title: '身份证号', align: 'center', ellipsis: true },
{ colKey: 'tjsj', title: '添加时间', align: 'center', width: '220' },
{
colKey: 'handl',
title: '操作',
align: 'center',
width: '220',
cell: (h, { row }) => {
return (

<t-button variant="text" theme="primary" onClick={() => detialsShow(row)}>
详情

<t-button variant="text" theme="primary" onClick={() => editClickDialog(row)}>
编辑

<t-button variant="text" theme="danger" onClick={() => delFucn(row)}>
删除

);
},
},
]);
const tableData=[{
asjfskssj: "2024-11-15 01:01",
ay: "2024年11月15日08:47:43",
bz: "2024年11月15日08:47:43",
fj: "data:image/gif;base64,R0lGODlhXga6A/f/ABtNaRxZdAw,
fxdj: null,
jflb: "由工程施工引发的",
jqdxbs: "56b3fe2222b9355e696ec61a37",
jqly: "1",
pcsmc: "干啊!",
rs: 1,
sacs_dzmc: "2024年11月15日08:47:43",
sfxtw: "否",
sfzh: "312222195810170438",
tjsj:"11/14/2024 16:49:11",
xm: "夏哈哈",}]

@JinPing5306
Copy link
Author

` const pagination = reactive({ current: 1, pageSize: 20, total: 0, });

function tableChange(e) { pagination.current= e.pagination.current; pagination.pageSize= e.pagination.pageSize; `,不要用默认的default参数
不用默认的default参数也不行

@china-chaim
Copy link

china-chaim commented Nov 18, 2024

@page-change="onPageChange"

const pagination =ref({ current: 1, pageSize: 20, total: 0, });
const onPageChange = async (pageInfo) => {
pagination.value.current = pageInfo.current;
pagination.value.pageSize = pageInfo.pageSize;
};
pagination 的定义reactive换成ref
我用的默认分页方法,然后受控方式分页查询,带default的查询之前也遇到问题,解决方案没找到

@JinPing5306
Copy link
Author

@page-change="onPageChange"

const pagination =ref({ current: 1, pageSize: 20, total: 0, }); const onPageChange = async (pageInfo) => { pagination.value.current = pageInfo.current; pagination.value.pageSize = pageInfo.pageSize; }; pagination 的定义reactive换成ref 我用的默认分页方法,然后受控方式分页查询,带default的查询之前也遇到问题,解决方案没找到

解决了,谢谢大哥

@uyarn
Copy link
Collaborator

uyarn commented Nov 18, 2024

@page-change="onPageChange"

const pagination =ref({ current: 1, pageSize: 20, total: 0, }); const onPageChange = async (pageInfo) => { pagination.value.current = pageInfo.current; pagination.value.pageSize = pageInfo.pageSize; }; pagination 的定义reactive换成ref 我用的默认分页方法,然后受控方式分页查询,带default的查询之前也遇到问题,解决方案没找到

@china-chaim 是说reactive的非受控方法 会出现这个issue描述的问题?

@china-chaim
Copy link

@page-change="onPageChange"
const pagination =ref({ current: 1, pageSize: 20, total: 0, }); const onPageChange = async (pageInfo) => { pagination.value.current = pageInfo.current; pagination.value.pageSize = pageInfo.pageSize; }; pagination 的定义reactive换成ref 我用的默认分页方法,然后受控方式分页查询,带default的查询之前也遇到问题,解决方案没找到

@china-chaim 是说reactive的非受控方法 会出现这个issue描述的问题?

不确定,非受控方法除了这种情况ref的之前也有遇到过,后来全换了受控方法,效果实现后没仔细查看具体原因。还有table tree 默认展开也是无效,文档示例没问题,换成接口获取数据就出问题了。查了下资料,可能是响应式数据更新后,参数没渲染成功

@uyarn uyarn added the usage the issue about component usage label Nov 20, 2024
@uyarn uyarn closed this as completed Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usage the issue about component usage
Projects
None yet
Development

No branches or pull requests

3 participants