折叠组件立即关闭

时间:2019-05-13 09:31:22

标签: reactjs react-native reactstrap

我正在尝试使用Reactstrap中的“ UncontrolCollapse”组件,并且遇到问题,使其在切换时立即关闭。

这是我的代码。

    constructor(props){
        super(props);
    }

    render() {
        return (
            <section className={'section'}>
                <img style={{position:'absolute',top:0,bottom:0,right:0,margin:'auto'}} height={'100%'} width={'auto'} src={header2}/>
                <Container className={'second-container-set'}>
                    <h2>
                        XXX
                    </h2>
                    <Row>
                        <Col xs="4">
                            <div id={'ARS'}>
                                <Card>
                                    <a href="https://www.occitanie.ars.sante.fr" target="_blank">
                                    <CardImg top width="50%" src={ars} alt="ARS"/>
                                    </a>
                                    <CardBody>
                                        <CardTitle className={'second-titre'}>Agence Régionale de Santé Occitanie</CardTitle>
                                        <UncontrolledCollapse toggler='#toggler'>
                                        <CardText>XXXXX</CardText>
                                        </UncontrolledCollapse>
                                    </CardBody>
                                    <Button color="primary" id='toggler' style={{ marginBottom: '1rem' }}>
                                        En savoir plus
                                    </Button>
                                </Card>
                            </div>
                        </Col>
                    </Row>
                </Container>
            </section>
        );
    }
}

除了该组件保持打开状态,直到我再次单击按钮为止。

0 个答案:

没有答案