ant-design / ant-design/pro-components
数据更新 页面不更新
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 1.4k
- Avg merge
- 10h 44m
- Merged PRs (30d)
- 3
Description
const columns = useRef([
{
key: 'sort',
dataIndex: 'key',
editable: false,
width: 30,
},
{
title: '序号',
key: 'serial',
dataIndex: 'serial',
// editable: false,
width: '60px',
// render: (_: any, __: any, index: number) => index + 1, // 使用 index + 1 作为序号值
},
{
title: '字段名称',
dataIndex: 'lable',
width: '30%',
},
{
title: '是否显示',
dataIndex: 'visible',
valueType: 'checkbox',
width: '30%',
renderFormItem: (_: any, itemRecord: any) => {
// 自定义复选框的渲染
return {
console.log(itemRecord, "===record===");
// record
setDataSource((dataSource: any) => {
let _dataSource = cloneDeep(dataSource)
let recordfind = _dataSource.find((f: any) => f.id === itemRecord.record.id)
recordfind.visible = false
console.log(_dataSource, "===_dataSource====");
return _dataSource
})
}} checked={itemRecord.record.visible}>{itemRecord.record.visible}
}
},
{
title: '操作',
valueType: 'option',
width: 250,
render: () => {
return null;
},
},
])
我修改了 数据 但是页面并没有更新
Contributor guide
Research direction
Start from the provided TypeScript/React columns useRef configuration and its renderFormItem checkbox handler. Reproduce the update with the shown data source state change, then inspect why the page does not reflect it. Done means changing the data causes the displayed page to update.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100