Skip to content

Commit 6f27bb8

Browse files
committed
Simplify using-l + add demo to usage example
1 parent f73b957 commit 6f27bb8

File tree

2 files changed

+46
-29
lines changed

2 files changed

+46
-29
lines changed

docs/getting-started/usage.md

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,38 @@ Here is a basic example of how to use the `LMap` and `LTileLayer` components to
1010

1111
```vue
1212
<template>
13-
<div style="height:100vh; width:100vw">
14-
<LMap
15-
ref="map"
16-
:zoom="6"
17-
:center="[47.21322, -1.559482]"
18-
>
19-
<LTileLayer
20-
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
21-
attribution="&amp;copy; <a href=&quot;https://www.openstreetmap.org/&quot;>OpenStreetMap</a> contributors"
22-
layer-type="base"
23-
name="OpenStreetMap"
24-
/>
25-
</LMap>
26-
</div>
13+
<LMap
14+
style="height: 350px"
15+
:zoom="6"
16+
:center="[47.21322, -1.559482]"
17+
>
18+
<LTileLayer
19+
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
20+
attribution="&amp;copy; <a href=&quot;https://www.openstreetmap.org/&quot;>OpenStreetMap</a> contributors"
21+
layer-type="base"
22+
name="OpenStreetMap"
23+
/>
24+
</LMap>
2725
</template>
2826
```
27+
28+
And here is how it should look :
29+
30+
<script setup>
31+
import "leaflet/dist/leaflet.css";
32+
import { LMap, LTileLayer } from "@vue-leaflet/vue-leaflet";
33+
import { onMounted } from 'vue';
34+
35+
onMounted(() => {
36+
import('leaflet')
37+
})
38+
</script>
39+
40+
<LMap style="height: 350px" :zoom="6" :center="[47.21322, -1.559482]">
41+
<LTileLayer
42+
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
43+
attribution="&amp;copy; <a href=&quot;https://www.openstreetmap.org/&quot;>OpenStreetMap</a> contributors"
44+
layer-type="base"
45+
name="OpenStreetMap"
46+
/>
47+
</LMap>

docs/guide/using-l.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,20 @@ You might want to access the Leaflet global variable in your Vue component. This
55
The L variable is auto-imported by the module, so you can access it directly in your Vue component as shown below.
66

77

8-
```vue{21-23}
8+
```vue{19-21}
99
<template>
10-
<div style="height:100vh; width:100vw">
11-
<LMap
12-
:zoom="6"
13-
:max-zoom="18"
14-
:center="[47.21322, -1.559482]"
15-
>
16-
<LTileLayer
17-
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
18-
attribution="&amp;copy; <a href=&quot;https://www.openstreetmap.org/&quot;>OpenStreetMap</a> contributors"
19-
layer-type="base"
20-
name="OpenStreetMap"
21-
/>
22-
</LMap>
23-
</div>
10+
<LMap
11+
:zoom="6"
12+
:max-zoom="18"
13+
:center="[47.21322, -1.559482]"
14+
>
15+
<LTileLayer
16+
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
17+
attribution="&amp;copy; <a href=&quot;https://www.openstreetmap.org/&quot;>OpenStreetMap</a> contributors"
18+
layer-type="base"
19+
name="OpenStreetMap"
20+
/>
21+
</LMap>
2422
</template>
2523
2624
<script setup>

0 commit comments

Comments
 (0)