我正在尝试为我的Google自动填充组件更改pac-container。我想为这个pac-container设置样式,但是我不知道如何引用已经定义的类名的css。
这是我的代码
...
constructor(props) {
super(props);
this.state = {
address_ignore_autofill: this.props.address,};
this.autocomplete = null;
}
componentDidmount() {
this.autocomplete = new
google.maps.places.Autocomplete(document.getElementById('address'),{});
this.autocomplete.addListener("place_changed",this.handlePlaceSelect)
}
handleFormChange = (event) => {
this.setState({ address_ignore_autofill: event.target.value });
};
render() {
const { classes } = this.props;
return (
<TextField
onChange={(e) => this.handleFormChange(e)}
/>
);
}
我应该在哪里修改.pac-container?
?我尝试在index.css
中进行修改,但这是行不通的。我还尝试过将<Textfield/>
类包装到div
中并进行
import './test.css'
<div classname='test'>
<Textfield>
</div>
和
this is test.css
.test .pac-container {
margin-top: 500
}
但是那也不起作用。
做
.pac-container {
margin-top: 500
}
也不起作用。
我知道我缺少一些非常愚蠢的东西。请帮忙。谢谢