pro-components icon indicating copy to clipboard operation
pro-components copied to clipboard

🧐[问题]protable的request会在其他组件onChange的时候触发

Open HoraceZ919 opened this issue 3 years ago • 0 comments
trafficstars

🧐 问题描述

类似下面的逻辑,如果把ProTable封装在一个组件里面再返回的话,Header的按钮也会触发ProTable的request。但是直接写就不会有这个问题。

💻 示例代码

const Header = () => (
    <Button
        onClick={() => {
            showModal(true)
        }}
    ></Button>
)
const TableContent = () => <ProTable {...props} request={() => {}} />

return (
    <>
        <Row gutter={[8, 12]}>
            <Col span={24}>
                <Header />
            </Col>
            <Col span={24}>
                <TableContent /> //ProTable封装在里面的话,Header的按钮也会触发ProTable的request
                <ProTable {...props} /> //写外面就可以
            </Col>
        </Row>
        <Modal {...props} />
    </>
)

🚑 其他信息

HoraceZ919 avatar Sep 25 '22 06:09 HoraceZ919