[英]React map not rendering
我无法在屏幕上显示我的Google地图。 我已经看到了这个问题,但是即使这样做也没有解决我的问题。
我有的:
import React from 'react'
import GoogleMap from 'google-map-react';
import withStyles from 'isomorphic-style-loader/lib/withStyles'
import s from './CarMap.css'
class MoobieMap extends React.Component {
constructor(props){
super(props)
}
render() {
return (
<div className={s.map}>
<GoogleMap apiKey={API_KEY} center={{lat: -23.5925282, long: -46.6891377}} zoom={3}/>
</div>
)
}
}
export default withStyles(s)(MoobieMap)
和:
import React from 'react'
import Layout from '../../components/Layout'
import MoobieMap from './CarMap'
const title = 'Mapa de carros'
export default {
path: '/car-map',
async action() {
return {
title,
chunk: 'component',
component: <Layout title={title}><MoobieMap /></Layout>,
}
},
}
和CSS:
.map {
width: 100%;
height: 400px;
}
我的控制台中也没有js错误。
我在这里想念什么? 谢谢!!!
尝试仅导入将它们命名为的css wihtout:
import React from 'react'
import GoogleMap from 'google-map-react';
import withStyles from 'isomorphic-style-loader/lib/withStyles'
import './CarMap.css'
class MoobieMap extends React.Component {
constructor(props){
super(props)
}
render() {
return (
<div>
<GoogleMap apiKey={API_KEY} center={{lat: -23.5925282, long: -46.6891377}} zoom={3} className="map"/>
</div>
)
}
}
export default withStyles(s)(MoobieMap)
MoobieMap和withstyles之间的连接是什么?
希望对您.map
帮助,请告诉我您的.map
声明了宽度和高度...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.