forked from GuillaumeLeclerc/vue-google-maps
-
Notifications
You must be signed in to change notification settings - Fork 475
/
info-bar.html
63 lines (55 loc) · 1.55 KB
/
info-bar.html
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
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="root">
You should see a blue status bar with a description of the place at the
position of the marker when you move your mouse over the markers.
<gmap-map
:center="center"
:zoom="15"
style="width: 100%; height: 500px"
>
<gmap-marker
v-for="m in markers"
:position="{lat: m.position[0], lng: m.position[1]}"
:clickable="true"
:draggable="true"
@click="center = m.position"
@mouseover="statusText = m.text"
@mouseout="statusText = null"
></gmap-marker>
<div slot="visible">
<div style="bottom: 0; left: 0; background-color: #0000FF; color: white; position: absolute; z-index: 100">
{{statusText}}
</div>
</div>
</gmap-map>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.0/vue.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.16.4/lodash.js"></script>
<script src="vue-google-maps.js"></script>
<script>
Vue.use(VueGoogleMaps, {
load: {
key: 'AIzaSyDf43lPdwlF98RCBsJOFNKOkoEjkwxb5Sc'
},
});
document.addEventListener('DOMContentLoaded', function() {
new Vue({
el: '#root',
data: {
center: {lat: 47.376332, lng: 8.547511},
statusText: '',
markers: [{
position: [47.376332, 8.547511],
text: 'Hauptgebäude der ETH Zürich'
}, {
position: [47.374592, 8.548867],
text: 'Hauptgebäude der Universität Zürich'
}]
},
});
});
</script>
</body>