fix: add back ssr
This commit is contained in:
parent
10964ec587
commit
71e0ad89a1
2 changed files with 8 additions and 7 deletions
|
@ -1,11 +1,13 @@
|
|||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
import 'leaflet/dist/leaflet.css';
|
||||
import lignes from './lignes.json';
|
||||
|
||||
import L from 'leaflet';
|
||||
onMount(async () => {
|
||||
const L = (await import('leaflet')).default;
|
||||
|
||||
function createMap(node: HTMLElement) {
|
||||
const map = L.map(node).setView([45.76, 4.832], 13);
|
||||
const map = L.map('map').setView([45.76, 4.832], 13);
|
||||
|
||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
|
@ -18,13 +20,13 @@
|
|||
// @ts-ignore
|
||||
L.geoJSON(feature, { style: { color } }).addTo(map);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="map" use:createMap></div>
|
||||
<div id="map"></div>
|
||||
|
||||
<style>
|
||||
.map {
|
||||
#map {
|
||||
height: 100vh;
|
||||
width: 100%;
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
export const ssr = false;
|
Loading…
Add table
Add a link
Reference in a new issue