forked from xkjyeah/vue-google-maps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasic-marker-clusterer.html
53 lines (48 loc) · 1.3 KB
/
basic-marker-clusterer.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
<body>
<div id="root">
<gmap-map :center="center" :zoom="7" style="width: 100%; height: 500px">
<gmap-cluster>
<gmap-marker v-for="(m, index) in markers"
:position="m.position"
:clickable="true" :draggable="true"
@click="center=m.position"
:key="index"
></gmap-marker>
</gmap-cluster>
</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/markerclustererplus/2.1.4/markerclusterer.js"></script>
<script src="vue-google-maps.js"></script>
<script>
Vue.use(VueGoogleMaps, {
load: {
key: 'AIzaSyDf43lPdwlF98RCBsJOFNKOkoEjkwxb5Sc'
},
});
document.addEventListener('DOMContentLoaded', function() {
// gmapCluster *must* be manually imported
Vue.component('gmap-cluster', VueGoogleMaps.Cluster);
new Vue({
el: '#root',
data: {
center: {
lat: 10.0,
lng: 10.0
},
markers: [{
position: {
lat: 10.0,
lng: 10.0
}
}, {
position: {
lat: 11.0,
lng: 11.0
}
}]
},
});
});
</script>
</body>