繁体   English   中英

Styled-components vs Emotion - 如何在 Styled-components 上重新应用 css`style` function

[英]Styled-components vs Emotion - How to reapplicate css`style` function on Styled-components

我有一个使用Emotion库的代码。 到目前为止,一切正常...

但是查看文档,我看到Styled-components已经吸收了Emotion库的一些特性; 在 javascript 中使用css 8CBA22E28EB17B5F5C6AE2A266AZ。

但我无法复制与Emotion最不相似的用法。

这是一个完整的例子(使用Emotion ):

https://codesandbox.io/s/grouping-table-head-ant-design-demo-s7hb6?file=/index.js

基本上我想用一些动态的 styles (取决于对象数组)创建一个 CSS。 工作正常而且很干净......但我的问题是知道这段代码是否可以使用Styled-components重新应用(使用css表示法)。

类似于这篇文章的东西(我不能让它工作):

https://medium.com/styled-components/announcing-native-support-for-the-css-prop-in-styled-components-245ca5252feb

任何想法?

styled-components上搜索此功能后; 归根结底,是不可能的。

其他替代方法是使用CSS ModulesEmotionstyled jsx或类似的......但到目前为止还不可能使用styled-components

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM