x-render icon indicating copy to clipboard operation
x-render copied to clipboard

两个问题:初始值不生效、空表格的状态下 total 是 1

Open mzl980425 opened this issue 3 years ago • 0 comments

1.依赖仓库的版本(Dependencies versions)

  • react:18.0.20
  • form-render:1.13.14
  • table-render: 1.3.7
  • antd:4.23.2

2.问题描述(Bug description): 问题1:TableRender 的 Search 里的 range 类型,设置了默认值,初始请求时不生效

image

image

问题2:api 里抛异常的时候,table 的 total 居然是 1,应该是 0 才对

image

3.最小复现 demo(Reproduction demo)


const Test = () => {
  const schema = {
    type: 'object',
    properties: {
      _time: {
        title: '日期',
        type: 'range',
        format: 'date',
        bind: ['startTime', 'endTime'],
        default: ['2022-01-01', '2022-01-31'],
      },
    },
  };

  const api = async (props) => {
    // 问题1:初始进来的时候期望 props 里是有 startTime、endTime 两个参数的,但是 log 出来没有
    console.log('props >>> ', props);

    // 问题2:抛异常的时候,页面内会显示总计 1 条数据
    throw '123';

    return { rows: [], total: 0 };
  };

  return (
    <Fragment>
      <Search schema={schema} api={api} />
      <Table
        columns={[{ dataIndex: '_', title: '_' }]}
        pagination={{ size: 'default', showSizeChanger: true, showTotal: (total) => `总计 ${total} 条数据` }}
      />
    </Fragment>
  );
};

export default withTable(Test);

mzl980425 avatar Sep 22 '22 12:09 mzl980425