【发布时间】:2019-10-09 01:52:15
【问题描述】:
我在我的 react 应用程序中使用样式化组件 我想添加标题属性(用于工具提示) 应用于我的样式组件
我尝试使用包装器 div html 元素并在其上应用标题标签但无法做到,也尝试使用 css`` 样式的组件助手无法做到。
my styled components: (with ellipsis):
const FilterTitle = styled.div`
display: inline-block;
width: 100%;
line-height: 40px;
height: 40px;
color: ${blackChosen};
font-family: Poppins;
font-size: 16px;
letter-spacing: 0.15px;
padding-left: 15px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-weight: ${props => (props.chosen) ? '500' : 'initial'};
`;
and:
<FilterTitle> I might be a long sentence shown with ... and the title tag should tooltip me</FilterTitle>
【问题讨论】: