gpt4 book ai didi

reactjs - React-jss : Warning: Rule is not linked. 缺少工作表选项 "link: true"

转载 作者:行者123 更新时间:2023-12-05 03:04:00 24 4
gpt4 key购买 nike

我正在尝试更改 Material-UI 输入组件的下划线边框颜色。但是下面的代码不起作用并给我以下错误:

警告:规则未链接。缺少工作表选项“link: true”

这些是我的进口:

import React from "react";
import classNames from "classnames";
import PropTypes from "prop-types";
import injectSheet from "react-jss";
import customInputStyle from "../../assets/jss/material-dashboard-react/components/customInputStyle.jsx";

这些是组合的类名:

  const underlineClasses = classNames({
[classes.underlineError]: error,
[classes.underlineSuccess]: success && !error,
[classes.underlineCustom]: customColor,
[classes.underline]: true
});

如果错误或成功 Prop 为真,它会显示正确的颜色。如果已定义,我想根据 Prop customColor 设置下划线颜色,因此我无法定义静态颜色。

这是使用组合类名的组件:

  <Input
classes={{
underline: underlineClasses
}}
/>

这是样式对象:

const customInputStyle = {
underline: {
"&:hover:not($disabled):before,&:before": {
borderColor: "#D2D2D2 !important",
borderWidth: "1px !important"
},
"&:after": {
borderColor: primaryColor
}
},
underlineError: {
"&:after": {
borderColor: dangerColor
}
},
underlineSuccess: {
"&:after": {
borderColor: successColor
}
},
underlineCustom: {
"&:after": {
borderColor: props => props.customColor
}
}
}

这是我导出组件的方式:

export default injectSheet(customInputStyle, { link: true })(CustomInput);

最佳答案

关于reactjs - React-jss : Warning: Rule is not linked. 缺少工作表选项 "link: true",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53324307/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com