【发布时间】:2020-09-29 13:06:09
【问题描述】:
我想改变 infowindow 的样式:
创建一个 CSS 文件来更改 .gm-style .gm-style-iw-d 和 .gm-style .gm-style-iw-c 属性,但没有什么可更改的,我想更改或禁用 max-width ,over-flow:scroll ,padding-right,...就像这张照片:
我读了这个链接:InfoWindowOptions 并写下这一行以更改maxWidth:
<InfoWindow options={{maxWidth:300}} onCloseClick={() => togelOpenCloseInfoWindos}>
但没什么可改变的。
这是我的代码:
{isOpen &&
<InfoWindow options={{ maxWidth: 300 }} style={{ backgroundColor: 'red' }} onCloseClick={() => togelOpenCloseInfoWindos}>
<Grid container style={{ paddingLeft: 8, paddingRight: 8, }} xs={12} spacing={0} >
<Grid item xs={7} sm={8} zeroMinWidth>
<Typography noWrap component="p">
<Box fontWeight="bold">
{props.MyProps.locations.NICKNAME}</Box>
</Typography>
{/* <p className={classes.card_title}>{car.NICKNAME}</p> */}
</Grid>
<Grid item xs={5}>{speed_logo(props.MyProps.locations)}</Grid>
<Grid item xs={7} style={{ marginTop: -9 }}><p className={classes.card_time}>{timeToShow(props.MyProps.locations.SENTDATE)}</p></Grid>
<Grid item xs={5} style={{ marginTop: -9 }}>{tempture_logo(props.MyProps.locations)}</Grid>
<Grid xs={12}><Typography component='p' className={classes.card_Address}>{props.MyProps.locations.POSDESCRIPTION}</Typography></Grid> </Grid>
</InfoWindow>
}
请帮我更改 infoWindow 的样式
【问题讨论】:
标签: reactjs google-maps react-google-maps