【发布时间】:2021-10-24 13:32:56
【问题描述】:
我的自定义颜色“主要”在构建模式下不起作用并消失了。但在开发模式下它存在。
tailwind.config.js
module.exports = {
purge: ["./src/**/*.{js,jsx,ts,tsx}", "./public/index.html"],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {
colors: {
primary: "#C62C2C",
secondary: "#6558f5",
dark: "#000000",
},
},
fontFamily: {
body: ["Inter", "sans-serif"],
},
},
variants: {
extend: {},
},
plugins: [],
};
按钮组件
const Button = (props) => {
return (
<button
className={`rounded-lg ${props.className ? props.className : "1"} ${
props.padding
} text-sm text-white bg-${props.color}`}
onClick={props.onClick}
>
{props.children}
</button>
);
};
调用按钮组件
<Button color="primary" padding="px-6 py-2"></Button>
【问题讨论】:
-
您的构建版本中是否存在所有其他样式?
标签: reactjs tailwind-css tailwind-ui