generated from devspacemx/template-proyectos
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathMapa.vue
73 lines (66 loc) · 1.22 KB
/
Mapa.vue
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
<template>
<div id="mapContainer"></div>
</template>
<page-query>
query Community {
communities: allCommunity(sortBy: "date", limit: 6) {
edges {
node {
id
path
title
location {
title
path
}
image (width: 100, quality: 70)
}
}
}
}
</page-query>
<script>
import mapboxgl from "mapbox-gl";
export default {
data() {
return {
accessToken:
"pk.eyJ1IjoibXJhcmMiLCJhIjoiY2pjbnFhOGl2MWt5ZTMwcGY1dDdwajVydSJ9.7dAnNN6tF3yu8caZ07k0Cw",
center: [-95.3616427, 10.2003923],
mapStyle: "mapbox://styles/mrarc/cjponzrq10dfg2rp7zaij9uhi?optimize=true",
map: null,
};
},
metaInfo() {
return {
title: "Mapa",
};
},
methods: {
},
mounted() {
mapboxgl.accessToken = this.accessToken;
new mapboxgl.Map({
container: "mapContainer",
style: "mapbox://styles/mapbox/streets-v11",
center: [103.811279, 1.345399],
zoom: 12,
maxBounds: [
[103.6, 1.1704753],
[104.1, 1.4754753],
],
});
},
};
</script>
<style lang="scss">
@import "~mapbox-gl/dist/mapbox-gl.css";
html,
body {
margin: 0;
}
#app {
margin: 0;
height: 100vh;
}
</style>