【问题标题】:reactstrap Collapse does not have any formating, and neither does cardreactstrap Collapse 没有任何格式化,card 也没有
【发布时间】:2019-11-30 22:27:48
【问题描述】:

Reactstraps 卡片和折叠似乎不起作用。我不知道我做错了什么,但我尝试了几种不同的方法都无济于事。文本就在那里,按钮什么也不做。

我尝试过 reactstrap、react bootstrap 和普通的 html 代码。我正在使用 rekit ide 来处理这个项目。

import React, { Component } from 'react';
import { Collapse, Button, CardBody, Card } from 'reactstrap';

class Example extends Component {
  constructor(props) {
super(props);
this.toggle = this.toggle.bind(this);
this.state = { collapse: false };
  }

  toggle() {
this.setState(state => ({ collapse: !state.collapse }));
  }

  render() {
return (
  <div>
    <Button color="primary" onClick={this.toggle} style={{ marginBottom: '1rem' }}>Toggle</Button>
    <Collapse isOpen={this.state.collapse}>
      <Card>
        <CardBody>
        Anim pariatur cliche reprehenderit,
         enim eiusmod high life accusamus terry richardson ad squid. Nihil
         anim keffiyeh helvetica, craft beer labore wes anderson cred
         nesciunt sapiente ea proident.
        </CardBody>
      </Card>
    </Collapse>
  </div>
    );
  }
}

export default Example;

当我按下按钮时,我应该得到一张折叠卡片,但我什么也没得到。

【问题讨论】:

    标签: javascript node.js reactjs reactstrap


    【解决方案1】:

    你是否安装了引导程序

    npm install --save bootstrap 
    

    并将其导入到Installation Guide 之后的src/index.js 文件中,如下所示:

    import 'bootstrap/dist/css/bootstrap.min.css';
    

    【讨论】:

      猜你喜欢
      • 2020-12-25
      • 2023-01-22
      • 1970-01-01
      • 2018-06-15
      • 2014-06-06
      • 2012-08-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多