简体   繁体   English

如何在语义UI React Accordion中更改标题图标

[英]How to change Title icon in semantic UI React Accordion

https://react.semantic-ui.com/modules/accordion https://react.semantic-ui.com/modules/accordion

on their first example, I have a requirement where I need another icon instead of dropdown. 在他们的第一个示例中,我有一个要求,我需要另一个图标而不是下拉菜单。

I need to replace it with "angle right, angle down". 我需要将其替换为“直角,向下倾斜”。

<Accordion.Title active={activeIndex === 2} index={2} 
onClick={this.handleClick}>

  <Icon name='dropdown' />/* dropdown to angle right or down*/

  How do you acquire a dog?

</Accordion.Title>

Is anyone has experience with this? 有人对此有经验吗? how to change title icon on react-semantic-Accordion 如何更改React-Semantic-Accordion上的标题图标

Change the name of the icon : 更改图标的名称:

<Icon name='chevron right' />

ref : React semantic icon set ref: React语义图标集

I just faced this issue myself and since OP didn't post his solution, the following might help others. 我只是自己面对这个问题,由于OP没有发布他的解决方案,因此以下内容可能会对其他人有所帮助。

The same logic used to determine if the accordion is active can be used to set the title. 用于确定手风琴是否处于活动状态的逻辑可以用来设置标题。 Simply use a const for the icon name like 只需使用const作为图标名称即可

const iconName = activeIndex === 2 ? 'chevron down' : 'chevron right';
<Accordion.Title active={activeIndex === 2} index={2} this.handleClick}>

  <Icon name={iconName} />/* dropdown to angle right or down*/

  How do you acquire a dog?

</Accordion.Title>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM