-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathexample.vue
45 lines (40 loc) · 1.1 KB
/
example.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
<template>
<v-map :zoom="10" :center="initialLocation">
<v-tilelayer url="https://{s}.basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}{r}.png"></v-tilelayer>
<v-locatecontrol/>
</v-map>
</template>
<script>
import { Icon, latLng } from 'leaflet';
import { LMap, LTileLayer, LMarker } from "vue2-leaflet";
import Vue2LeafletLocatecontrol from './Vue2LeafletLocatecontrol';
// Icon fix
delete Icon.Default.prototype._getIconUrl;
Icon.Default.mergeOptions({
iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'),
iconUrl: require('leaflet/dist/images/marker-icon.png'),
shadowUrl: require('leaflet/dist/images/marker-shadow.png'),
});
export default {
components: {
"v-map": LMap,
"v-tilelayer": LTileLayer,
"v-marker": LMarker,
"v-locatecontrol": Vue2LeafletLocatecontrol,
},
data() {
return {
initialLocation: latLng(59.93428, 30.335098)
}
}
}
</script>
<style>
@import "~leaflet/dist/leaflet.css";
@import "https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css";
html,
body {
height: 100%;
margin: 0;
}
</style>