【发布时间】:2026-01-25 21:55:05
【问题描述】:
我有一个演示 here
它是一个简单的反应应用程序,我在其中使用带有主题的样式化组件
主题是这样的
import { DefaultTheme } from "styled-components";
export const theme: DefaultTheme = {
sizes: {
height: "50px",
width: "50px"
}
};
是否可以在样式化组件中将主题值与算术运算一起使用
类似
height: ${({ theme }) => theme.sizes.height}+
${({ theme }) => theme.sizes.height};
这在我的演示中不起作用,但我不知道语法是不正确还是不可能。
【问题讨论】:
-
"50px" + "50px"= "50px50px".