Skip to content

Commit b1d5ec8

Browse files
committed
Fix doc
1 parent ffe3531 commit b1d5ec8

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

docs/.vitepress/config.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ export default defineConfig({
2222
{ text: 'Usage', link: '/getting-started/usage' }
2323
]
2424
},
25+
{
26+
text: 'Guide',
27+
items: [
28+
{ text: 'Using L', link: '/guide/using-l' },
29+
{ text: 'Accessing Map Instance', link: '/guide/accessing-map-instance' },
30+
{ text: 'Leaflet Draw (Experimental)', link: '/guide/leaflet-draw' }
31+
]
32+
},
2533
{
2634
text: 'Components',
2735
items: [
@@ -49,14 +57,6 @@ export default defineConfig({
4957
{ text: 'LTooltip', link: '/components/l-tooltip' },
5058
{ text: 'LWmsTileLayer', link: '/components/l-wms-tile-layer' },
5159
]
52-
},
53-
{
54-
text: 'Guide',
55-
items: [
56-
{ text: 'Using L', link: '/guide/using-l' },
57-
{ text: 'Accessing Map Instance', link: '/guide/accessing-map-instance' },
58-
{ text: 'Leaflet Draw (Experimental)', link: '/guide/leaflet-draw' }
59-
]
6060
}
6161
],
6262

docs/getting-started/usage.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ onMounted(() => {
4646
name="OpenStreetMap"
4747
/>
4848
</LMap>
49+
50+
::: tip
51+
Note that you can set the `use-global-leaflet` prop to `true` (or remove it) if you're allready importing Leaflet in your app with `import L from 'leaflet'`.
52+
:::

docs/guide/using-l.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@
22

33
You might want to access the Leaflet global variable in your Vue component. This can be useful if you want to use a Leaflet plugin that is not available as a Vue component.
44

5-
The L variable is auto-imported by the module, so you can access it directly in your Vue component as shown below.
5+
You can still import the `L` global variable from the `leaflet` package and use it in your Vue component. Here is an example of how you can access the `L` global variable in a Vue component.
66

7+
::: warning
8+
This is only possible in a client-side environment. If you are using Nuxt.js, you should use the `client-only` component to ensure that the code is only executed on the client side or set your map route to `ssr: false`.
9+
:::
710

8-
```vue{19-21}
11+
```vue{6,18,21-23}
912
<template>
1013
<LMap
14+
style="height: 350px"
1115
:zoom="6"
12-
:max-zoom="18"
1316
:center="[47.21322, -1.559482]"
17+
:use-global-leaflet="true"
1418
>
1519
<LTileLayer
1620
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
@@ -21,7 +25,8 @@ The L variable is auto-imported by the module, so you can access it directly in
2125
</LMap>
2226
</template>
2327
24-
<script setup>
28+
<script setup lang="ts">
29+
import L from 'leaflet'
2530
import { onMounted } from 'vue'
2631
2732
onMounted(() => {

0 commit comments

Comments
 (0)