【问题标题】:Tool tip is not taking line breaks工具提示没有换行
【发布时间】:2020-06-11 17:43:10
【问题描述】:

我在使用 stackoverflow 上所有可能的东西搜索并尝试过的工具提示方面遇到问题,

我正在使用 reactjs 并使用 createElement 创建元素并应用工具提示类来启用它。

createElement('span', { toolTip, 'data-title': 'line1 <br/> line 2'},numericValue);

我也试过了

'/n'
'&#013;'

一切都按原样显示。 data-title 没有执行任何标签。

【问题讨论】:

    标签: javascript reactjs react-native


    【解决方案1】:

    我没有使用过createElement,但我在其他工具提示(如 react-bootstrap、reactstrap)中尝试过的一件事是将项目分隔到一个数组中。

    const label = ["Hello", <br />, "world!"]
    
    return <Tooltip label={label} />
    

    希望有帮助!

    【讨论】:

      猜你喜欢
      • 2015-05-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-10
      • 2013-01-14
      • 1970-01-01
      • 1970-01-01
      • 2017-11-06
      相关资源
      最近更新 更多