-
Notifications
You must be signed in to change notification settings - Fork 329
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
[Table] pagination 使用三元符并且data为空时,页面会展示之前数据的前十条数据 #2957
Comments
👋 @jacksonjin,感谢给 TDesign 提出了 issue。 |
import React, { useState, useEffect } from "react"; export default function EditableCellTable() { const [data, setData] = useState(arr); useEffect(() => { |
tdesign-react 版本
1.7.5
重现链接
https://codesandbox.io/p/sandbox/tdesign-react-demo-forked-r8ptn6?file=%2Fsrc%2Fdemo.jsx%3A1%2C1-38%2C1
重现步骤
重现代码关键是, pagination 是否是三元判断,如果pagination = {total,defaultPageSize, defaultCurrent},就不会出现问题
import React, { useState, useEffect } from "react";
import { Table } from "tdesign-react";
export default function EditableCellTable() {
const arr = Array.from({ length: 100 }, (_, index) => ({ id: index + 1 }));
const [data, setData] = useState(arr);
useEffect(() => {
setTimeout(() => {
setData([]);
}, 5000);
}, []);
const columns = [
{
title: "id",
colKey: "id",
},
];
// 当前示例包含:输入框、单选、多选、日期 等场景
return (
<Table
rowKey="key"
columns={columns}
data={data}
pagination={
data?.length
? {
defaultPageSize: 10,
defaultCurrent: 1,
total: data?.length,
}
: null
}
/>
);
}
期望结果
No response
实际结果
No response
框架版本
No response
浏览器版本
No response
系统版本
No response
Node版本
No response
补充说明
No response
Tasks
The text was updated successfully, but these errors were encountered: