【发布时间】:2016-08-30 09:04:40
【问题描述】:
我想在手风琴的标题中放置两个复选框。
示例是使用标准 HTML 和 JS 完成的,但我想使用 React Bootstrap 来实现。
给出的例子很简单。
const accordionInstance = (
<Accordion>
<Panel header="Collapsible Group Item #1" eventKey="1">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</Panel>
<Panel header="Collapsible Group Item #2" eventKey="2">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</Panel>
<Panel header="Collapsible Group Item #3" eventKey="3">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</Panel>
</Accordion>
);
ReactDOM.render(accordionInstance, mountNode);
但是换了header="Collapsible Group Item #1"
两个复选框,没那么容易。
我已经尝试过这种方法(删除 divs 的 <Panel> 标记),但我无法按照上面的 jsfiddle 示例让它工作。
<Accordion>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title pull-left">Header Text</h3>
<button class="btn btn-default pull-right">New</button>
<div class="clearfix"></div>
</div>
<div class="panel-body">
<p>This is the body</p>
</div>
</div>
</Accordion>
【问题讨论】:
-
也为引导代码添加小提琴
-
我们说话的时候在做(bootstrap fiddle)
标签: javascript reactjs accordion