@@ -6,57 +6,100 @@ import {
66 LTooltip ,
77 LPopup ,
88 LCircle ,
9- LPolygon
9+ LCircleMarker ,
10+ LPolygon ,
11+ LPolyline ,
12+ LRectangle ,
1013} from ' ../src' ;
1114import ' ../node_modules/leaflet/dist/leaflet.css' ;
1215
16+ const mapOptions = {
17+ zoom: 13 ,
18+ center: { lat: 51.505 , lng: - 0.09 },
19+ minZoom: 8 ,
20+ maxZoom: 15 ,
21+ attributionControl: true ,
22+ zoomControl: true
23+ }
24+
25+ const tileLayerOptions = {
26+ attribution: ' vue-leaflet' ,
27+ maxZoom: 18 ,
28+ id: ' mapbox/streets-v11' ,
29+ tileSize: 512 ,
30+ zoomOffset: - 1 ,
31+ accessToken: ' pk.eyJ1IjoieHdwaXNtZSIsImEiOiJ5cTlCQTlRIn0.QdV-wNUKbgs7jAlbVE747Q'
32+ }
33+
1334 </script >
1435
1536<template >
16- <l-map id =" map1" :options =" {
17- zoom: 13,
18- center: { lat: 51.505, lng: -0.09 },
19- minZoom: 8,
20- maxZoom: 15,
21- attributionControl: true,
22- zoomControl: true
23- }" >
24- <l-tilelayer urlTemplate =" https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}"
25- :options =" {
26- attribution: 'vue-leaflet',
27- maxZoom: 18,
28- id: 'mapbox/streets-v11',
29- tileSize: 512,
30- zoomOffset: -1,
31- accessToken: 'pk.eyJ1IjoieHdwaXNtZSIsImEiOiJ5cTlCQTlRIn0.QdV-wNUKbgs7jAlbVE747Q'
37+ <div >
38+ <h1 >Marker/Tooltip/Popup</h1 >
39+ <l-map id =" map1" :options =" mapOptions" >
40+ <l-tilelayer urlTemplate =" https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}"
41+ :options =" tileLayerOptions" />
42+ <l-marker id =" marker1" :latlng =" { lat: 51.505, lng: -0.09 }" :options =" {
43+ title: 'marker1',
44+ opacity: 1,
45+ draggable: true
46+ }" >
47+ <l-tooltip :options =" { content: 'tooltip with marker1' }" />
48+ </l-marker >
49+ <l-marker id =" marker2" :latlng =" { lat: 51.505, lng: -0.11 }" :options =" {
50+ title: 'marker2'
51+ }" >
52+ <l-popup :options =" { content: 'popup with marker2' }" />
53+ </l-marker >
54+ <l-tooltip :options =" { content: 'tooltip standalone' }" :latlng =" { lat: 51.505, lng: 0 }" />
55+ <l-popup :options =" { content: 'popup standalone' }" :latlng =" { lat: 51.505, lng: 0 }" />
56+ </l-map >
57+ </div >
58+ <div >
59+ <h1 >Vector Layers</h1 >
60+ <l-map id =" map2" :options =" mapOptions" >
61+ <l-tilelayer urlTemplate =" https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}"
62+ :options =" tileLayerOptions" />
63+ <l-circle :latlng =" [51.508, -0.11]" :options =" {
64+ color: 'red',
65+ fillColor: '#f03',
66+ fillOpacity: 0.5,
67+ radius: 500
3268 }" />
33- <l-marker :latlng =" { lat: 51.505, lng: -0.09 }" :options =" {
34- title: 'marker1',
35- opacity: 1,
36- draggable: true
37- }" >
38- <l-tooltip :options =" { content: 'tooltip with marker1' }" />
39- </l-marker >
40- <l-marker :latlng =" { lat: 51.505, lng: -0.11 }" :options =" {
41- title: 'marker2'
42- }" >
43- <l-popup :options =" { content: 'popup with marker2' }" />
44- </l-marker >
45- <l-tooltip :options =" { content: 'tooltip standalone' }" :latlng =" { lat: 51.505, lng: 0 }" />
46- <l-popup :options =" { content: 'popup standalone' }" :latlng =" { lat: 51.505, lng: 0 }" />
47- <l-circle :latlng =" [51.508, -0.11]" :options =" {
48- color: 'red',
49- fillColor: '#f03',
50- fillOpacity: 0.5,
51- radius: 500
52- }" />
53- <l-polygon :latlng =" [
54- [51.509, -0.08],
55- [51.503, -0.06],
56- [51.51, -0.047]
57- ]" />
58-
59- </l-map >
69+ <LCircleMarker :latlng =" [51.512, -0.18]" :options =" {
70+ color: 'red',
71+ fillColor: '#f03',
72+ fillOpacity: 0.5,
73+ radius: 100
74+ }" />
75+ <l-polygon :latlngs =" [
76+ [51.509, -0.08],
77+ [51.503, -0.06],
78+ [51.51, -0.047]
79+ ]" />
80+ <l-polyline :latlngs =" [
81+ [51.510, -0.09],
82+ [51.505, -0.07],
83+ [51.56, -0.048]
84+ ]" />
85+ <l-rectangle :latLngBounds =" [
86+ [51.510, -0.09],
87+ [51.505, -0.07],
88+ ]" />
89+ </l-map >
90+ </div >
91+ <div >
92+ <h1 >Control</h1 >
93+ <l-map id =" map3" :options =" mapOptions" >
94+ <l-tilelayer urlTemplate =" https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}"
95+ :options =" tileLayerOptions" />
96+ <!-- <l-marker id="marker3" :latlng="{ lat: 51.505, lng: -0.2 }" :options="{
97+ title: 'marker3'
98+ }">
99+ <l-popup :options="{ content: 'popup with marker3' }" />
100+ </l-marker> -->
101+ </l-map >
102+ </div >
60103</template >
61104
62105
@@ -68,17 +111,20 @@ import '../node_modules/leaflet/dist/leaflet.css';
68111 height : 100% ;
69112}
70113
71- #map1 {
72- height : 100% ;
114+ #map1 ,
115+ #map2 ,
116+ #map3 {
117+ height : 300px ;
73118}
74119
120+ html ,
75121body {
76122 padding : 0 ;
77123 margin : 0 ;
124+ height : 100% ;
78125}
79126
80- html ,
81- body {
82- height : 100% ;
127+ h1 {
128+ padding : 0 20px ;
83129}
84130 </style >
0 commit comments