-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgapp.js
73 lines (46 loc) · 1.46 KB
/
gapp.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// 2020, 7/30, am 9:30
// Google Map Feature
// usig only css style to modify its outlay
/*eslint eqeqeq:0*/
import React, {Component} from 'react';
import GoogleMapReact from 'google-map-react'; //需要 API Key
// not import {GoogleMapReact} from 'google-map-react';
import './GMAPapp.css'
//import {withGoogleMap, GoogleMap, Marker} from 'react-google-maps';
// npm install react-google-maps
const LocationPin = ({t})=>(
<div>
<p className="pin-text">{t}</p>
</div>
)
class GMAPapp extends Component {
constructor(props){
super(props);
this.state =
{
center:{
lat: 37.42,
lng: -122.08
},
zoom: 16
}
}
render(){
return(
<div style={{ height: '100vh', width: '100%' }}>
<GoogleMapReact
bootstrapURLKeys = {{key:'AIzaSyAAp2U6Cg3fgiJQkbc99p9P4aXZrsb6DIk'}}
defaultCenter = {this.state.center}
defaultZoom = {this.state.zoom}
>
<LocationPin className = 'pin'
lat={37.42216}
lng={-122.08427}
t="hi here I am"
/>
</GoogleMapReact>
</div>
)
}
}
export default GMAPapp;