antd表单的ProTable组件为可编辑表格时,数据源改变但是表格没重新渲染

//去掉dataIndex后只要dataSource变化,则dom就一定会渲染
// dataIndex: ‘value’,

{
      title: '按单处理',
      //去掉dataIndex后只要dataSource变化,则dom就一定会渲染
      // dataIndex: 'value',
      width: 120,
      editable: false,
      render: (_: any, record: any) => {
        return (
            <ProFormSelect
              allowClear
              formItemProps={{
                className: styles['no-margin-bottom'],
              }}
              fieldProps={{
                value: record.value,
                options: huiDanOptions,
                onChange(e) {
                  console.log('fatafa', e);
                  if (e) {
                    record.value = e;
                    record.boxs.forEach((o: any) => (o.value = e));
                  } else {
                    record.value = null;
                    record.boxs.forEach((o: any) => (o.value = null));
                  }

                  setDataSource((val: []) => [...val]);
                },
                getPopupContainer() {
                  return document.body;
                },
              }}
            />
          )
        );
      },
    },

你可能感兴趣的:(数据库)