我正在尝试学习 React 和 Material UI。
我正在创建一个 Web 表单,到目前为止一切都很好,除了页面加载时,chrome 会自动用以前存储的数据填充文本字段并且背景变为黄色。我怎样才能让它保持白色?
我知道在普通的 CSS 中我会包含以下代码:
input:-webkit-autofill {
-webkit-box-shadow: 0 0 0 1000px white inset;
}
但是,鉴于我不一定有样式表,这会带来一个问题。
我到目前为止:
const MyAwesomeReactComponent = React.createClass({
const containerStyle =
{
/* input:-webkit-autofill {
-webkit-box-shadow: 0 0 0 1000px white inset;
} */
};
return (
<div style={containerStyle}>
<form action="/login" method="post" autocomplete ="off">
<div>
<TextField hintText="Email Field" floatingLabelText="Email" underlineFocusStyle={{borderColor: Colors.amber900}} />
</div>
<div>
<TextField hintText="Password Field" floatingLabelText="Password" type="password" />
</div>
<div>
<RaisedButton label="Submit" primary={true}/>
</div>
</form>
});
module.exports = MyAwesomeReactComponent;
input-webkit-autofill
解析代码时出现语法错误。