【发布时间】:2017-07-25 19:48:16
【问题描述】:
我正在尝试在 react 组件中应用内联样式,如下所示。这是设置样式的正确方法吗,如果不是,我该如何实现?
<div
{...customProps}
style={{ width: `${widthValue}%`,
animationDelay: `${animationDelay}s`,
zIndex: `${zIndex}`,
animation: `loadbar ${incrementValue}s linear forwards`}}
key={i}
className={`well-background--${group.concept}
well-GroupedProgressBar--progress
well-GroupedProgressBar--${props.heightSize}`}
/>,
谢谢
【问题讨论】:
-
你是如何测试这个的?
-
我相信这是正确的做法。正如其他答案所建议的那样,您可以为其使用自定义变量,但是您的解决方案应该可以正常工作。