【问题标题】:React - how to add fontsize into React.createElement?React - 如何将字体大小添加到 React.createElement 中?
【发布时间】:2021-07-26 15:30:29
【问题描述】:

我是块新手并学习 React - 我在下面有这部分功能:

AlertNotifications.prototype.render = function () {
    return (React.createElement("div", null, this.props.alerts.map(function (alert) { return React.createElement(MessageBar, { messageBarType: alert.type === AlertType.Urgent ? MessageBarType.severeWarning : MessageBarType.warning, isMultiline: false },
        alert.message,
        alert.moreInformationUrl ? React.createElement("a", { href: alert.moreInformationUrl }, strings.MoreInformation) : ''); })));
};
return AlertNotifications;

我需要更改返回的 DIV 的字体大小 - 请告诉我我需要更改什么 - 或添加到上面以将字体大小更改为 Arial 16px?

在此先感谢

G

【问题讨论】:

    标签: reactjs fonts createelement


    【解决方案1】:

    您可以添加一个类并为其设置样式。

    React.createElement('div', {class-here}, .......)
    

    【讨论】:

      猜你喜欢
      • 2019-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-19
      相关资源
      最近更新 更多