如何使用ReactStrap将工具提示添加到禁用按钮



我有一个按钮,可以根据条件启用和禁用,我想在禁用按钮中添加工具提示。我不知道如何使用reatstrap。

<Col sm={6}>
<Button
type="button"
id = {`button-${companyId}`}
disabled={
this.company[companyId] &&
this.company[companyId].length
? false
: true
}
title = {this.company[company.id].length < 1? // As a makeover i Used title
"Not Active" : ""}
style={{ marginLeft: "-16px" }}

>
</Button>
User list
{this.company[companyId].length < 1 ? (
<UncontrolledTooltip
target={`button-${companyId}`}
placement="bottom"
fade={false}
>
"Active"
</UncontrolledTooltip>
) : null}

</Col> 

但这不会为按钮添加工具提示。有人能告诉我在这里做错了什么吗。

我建议您使用这样的条件;

<Button 
color="secondary" 
size="lg" 
disabled={(this.company[companyId] && this.company[companyId].length) ? false: true}>
Button
</Button>

disabled={!(this.company[companyId] && this.company[companyId].length)}>

最新更新