Javascript I';我在导入脉轮UI时遇到了这个错误
我在导入Chakra UI时遇到了这个错误Javascript I';我在导入脉轮UI时遇到了这个错误,javascript,html,css,chakra,Javascript,Html,Css,Chakra,我在导入Chakra UI时遇到了这个错误 if (variantColorIsDefined) { var variantColorExists = variantColor in theme.colors; // If variant color exists in theme object ^ 114 | if (!variantColorExists) { console.warn("You passed an i
if (variantColorIsDefined) {
var variantColorExists = variantColor in theme.colors; // If variant color exists in theme object
^ 114 |
if (!variantColorExists) {
console.warn("You passed an invalid variantColor to the " + label + " Component. Variant color values must be a color key in the theme object that has '100' - '900' color values. Check http://chakra-ui.com/theme#colors to see possible values");
这在文档中有点难以理解,一种变体颜色实际上是一组颜色 在主题中,您需要定义颜色和相应的:悬停值,例如,so:
yellow: {
500: "#FFFF80", //this is the default color
600: "#FFFF00" //this is the color on hover
},
然后在组件中引用它,如下所示:
<IconButton size="sm" icon="unicorn" isRound variantColor="yellow" />